AngularJS Toggle, True/False
AngularJS Toggle, True/False
버튼을 클릭 할 때 HTML 코드 섹션을 표시하고 드롭 다운 메뉴처럼 버튼을 다시 클릭하면 숨기기 버튼이 토글 스위치처럼 동작하도록하십시오.
Example
<div ng-app="myApp" ng-controller="myCtrl">
<button ng-click="myFunc()">Click Me!</button>
<div ng-show="showMe">
<h1>Menu:</h1>
<div>Pizza</div>
<div>Pasta</div>
<div>Pesce</div>
</div>
</div>
<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
$scope.showMe = false;
$scope.myFunc = function() {
$scope.showMe = !$scope.showMe;
}
});
</script>
<!DOCTYPE html>
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
<body>
<div ng-app="myApp" ng-controller="myCtrl">
<button ng-click="myFunc()">Click Me!</button>
<div ng-show="showMe">
<h1>Menu:</h1>
<div>Pizza</div>
<div>Pasta</div>
<div>Pesce</div>
</div>
</div>
<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
$scope.showMe = false;
$scope.myFunc = function() {
$scope.showMe = !$scope.showMe;
}
});
</script>
<p>Click the button to show/hide the menu.</p>
</body>
</html>
showMe변수는 부울 값 아웃 시작 false.
이 myFunc함수는 (not) 연산자를 showMe사용하여 변수를 그 반대의 값으로 설정합니다 !.
버튼을 클릭 할 때 HTML 코드 섹션을 표시하고 드롭 다운 메뉴처럼 버튼을 다시 클릭하면 숨기기 버튼이 토글 스위치처럼 동작하도록하십시오.
Example
<div ng-app="myApp" ng-controller="myCtrl">
<button ng-click="myFunc()">Click Me!</button>
<div ng-show="showMe">
<h1>Menu:</h1>
<div>Pizza</div>
<div>Pasta</div>
<div>Pesce</div>
</div>
</div>
<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
$scope.showMe = false;
$scope.myFunc = function() {
$scope.showMe = !$scope.showMe;
}
});
</script>
<!DOCTYPE html>
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
<body>
<div ng-app="myApp" ng-controller="myCtrl">
<button ng-click="myFunc()">Click Me!</button>
<div ng-show="showMe">
<h1>Menu:</h1>
<div>Pizza</div>
<div>Pasta</div>
<div>Pesce</div>
</div>
</div>
<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
$scope.showMe = false;
$scope.myFunc = function() {
$scope.showMe = !$scope.showMe;
}
});
</script>
<p>Click the button to show/hide the menu.</p>
</body>
</html>
showMe변수는 부울 값 아웃 시작 false.
이 myFunc함수는 (not) 연산자를 showMe사용하여 변수를 그 반대의 값으로 설정합니다 !.
게시판 목록
퍼블리싱강좌
| 번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|---|
| 118 | jQuery Mobile | 8년 전 | 1333 | ||
| 117 | jQuery Mobile | 8년 전 | 1585 | ||
| 116 | jQuery Mobile | 8년 전 | 1808 | ||
| 115 | jQuery Mobile | 8년 전 | 1771 | ||
| 114 | jQuery Mobile | 8년 전 | 1959 | ||
| 113 | jQuery Mobile | 8년 전 | 1869 | ||
| 112 | jQuery Mobile | 8년 전 | 2478 | ||
| 111 | jQuery Mobile | 8년 전 | 1782 | ||
| 110 | jQuery Mobile | 8년 전 | 1574 | ||
| 109 | jQuery Mobile | 8년 전 | 1732 | ||
| 108 | jQuery Mobile | 8년 전 | 1958 | ||
| 107 | jQuery Mobile | 8년 전 | 1763 | ||
| 106 | jQuery Mobile | 8년 전 | 1443 | ||
| 105 | jQuery Mobile | 8년 전 | 1738 | ||
| 104 | jQuery Mobile | 8년 전 | 2403 | ||
| 103 | jQuery Mobile | 8년 전 | 1551 | ||
| 102 | jQuery Mobile | 8년 전 | 1495 | ||
| 101 | jQuery Mobile | 8년 전 | 1677 | ||
| 100 | jQuery Mobile | 8년 전 | 1912 | ||
| 99 | jQuery Mobile | 8년 전 | 1365 | ||
| 98 | jQuery Mobile | 8년 전 | 1388 | ||
| 97 | jQuery Mobile | 8년 전 | 1648 | ||
| 96 | jQuery Mobile | 8년 전 | 1301 | ||
| 95 | jQuery Mobile | 8년 전 | 1124 | ||
| 94 | jQuery Mobile | 8년 전 | 1519 | ||
| 93 | jQuery Mobile | 8년 전 | 1141 | ||
| 92 | jQuery Mobile | 8년 전 | 1562 | ||
| 91 | jQuery Mobile | 8년 전 | 1509 | ||
| 90 | jQuery Mobile | 8년 전 | 1677 | ||
| 89 | jQuery Mobile | 8년 전 | 1656 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기