Я новичок в Angularjs. У меня есть 4 кнопки «edit, Reset password, ok, cancel». Когда загружается страница, я должен показывать кнопки редактирования и сброса пароля. Когда я нажимаю кнопку «ok и cancel», кнопки должны быть видимыми и «редактировать и сбрасывать пароль» должны быть скрыты, и наоборот. Но когда я нажимаю «Сброс пароля» всплывающую кнопку следует открыть. Как я могу это сделать?Angularjs button hide and show
-1
A
ответ
0
Вы можете использовать нг скрытие и нг-шоу для этого.
<input ng-hide = "someVariable"> abc </input>
Если «someVariable» истинно, этот входной элемент будет скрыт и будет виден, если он неверен.
Для получения дополнительной информации: https://docs.angularjs.org/api/ng/directive/ngHide
0
Вот код:
<head>
<script src="js/libs/angular.min.js"></script>
</head>
<body>
<h3 align="center">ng-Click ng-Show demo</h3>
<div ng-init="showButton=false" ng-controller="buttonController">
<button ng-show="showButton" ng-click="toggle()">Edit</button>
<button ng-show="showButton" ng-click="showPopup()">Reset Password</button>
<button ng-hide="showButton" ng-click="toggle()">OK</button>
<button ng-hide="showButton">CANCEL</button>
</div>
<script>
function buttonController($scope){
$scope.toggle=function(){
$scope.showButton=!$scope.showButton;
};
$scope.showPopup=function(){
window.alert("Do want to reset?");
}
}
</script>
</body>
Смежные вопросы
- 1. AngularJS Show and Hide
- 2. jquery show and hide button
- 3. Angularjs Show and hide button on checkbox check
- 4. jQuery show/hide select and button
- 5. hide and show image on button click
- 6. Show and Hide Controller не работает, AngularJS
- 7. AngularJS hide and show a char
- 8. Hide/Show Back Button
- 9. sencha hide show button
- 10. jquery show and hide
- 11. Toggle DIV hide and show
- 12. Show Hide Div AngularJs
- 13. jQuery hide/show more button
- 14. HTML JavaScript hide/show button
- 15. jQuery Show/Hide cookie button
- 16. VBA Word Hide/Show Button
- 17. Show/Hide onclick - angularjs
- 18. Js show and hide function
- 19. JQuery show and Hide elements
- 20. Jquery animate hide and show
- 21. jquery show and hide divs
- 22. jquery show and hide problem
- 23. # url section hide and show
- 24. Занять jQuery's show and hide
- 25. jQuery with hide and show
- 26. jQuery 3 - Show and Hide
- 27. Show/Hide and Slide Table
- 28. WinForm Show and Hide Puzzle
- 29. jQuery Show and Hide Content
- 30. jquery hide and show in different places
возможно дубликат [AngularJs: нг-шоу/нг скрыть] (http://stackoverflow.com/questions/12599637/angularjs-ng- show-ng-hide) –
что вы пробовали? Это довольно основательно и охвачено во многих учебниках и блогах на Angular. –