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사용하여 변수를 그 반대의 값으로 설정합니다 !.
게시판 목록
퍼블리싱강좌
| 번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|---|
| 148 | AngularJS | 8년 전 | 1665 | ||
| 147 | AngularJS | 8년 전 | 1081 | ||
| 146 | AngularJS | 8년 전 | 1266 | ||
| 145 | AngularJS | 8년 전 | 1374 | ||
| 144 | AngularJS | 8년 전 | 1163 | ||
| 143 | AngularJS | 8년 전 | 1208 | ||
| 142 | AngularJS | 8년 전 | 1176 | ||
| 141 | AngularJS | 8년 전 | 1338 | ||
| 140 | AngularJS | 8년 전 | 1204 | ||
| 139 | AngularJS | 8년 전 | 1450 | ||
| 138 | AngularJS | 8년 전 | 1157 | ||
| 137 | AngularJS | 8년 전 | 1068 | ||
| 136 | AngularJS | 8년 전 | 1167 | ||
| 135 | AngularJS | 8년 전 | 1686 | ||
| 134 | AngularJS | 8년 전 | 1392 | ||
| 133 | AngularJS | 8년 전 | 1486 | ||
| 132 | AngularJS | 8년 전 | 1105 | ||
| 131 | AngularJS | 8년 전 | 1379 | ||
| 130 | AngularJS | 8년 전 | 1467 | ||
| 129 | AngularJS | 8년 전 | 1450 | ||
| 128 | AngularJS | 8년 전 | 2070 | ||
| 127 | AngularJS | 8년 전 | 1494 | ||
| 126 | jQuery Mobile | 8년 전 | 2269 | ||
| 125 | jQuery Mobile | 8년 전 | 2027 | ||
| 124 | jQuery Mobile | 8년 전 | 1892 | ||
| 123 | jQuery Mobile | 8년 전 | 1825 | ||
| 122 | jQuery Mobile | 8년 전 | 1863 | ||
| 121 | jQuery Mobile | 8년 전 | 2068 | ||
| 120 | jQuery Mobile | 8년 전 | 1602 | ||
| 119 | jQuery Mobile | 8년 전 | 1682 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기