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사용하여 변수를 그 반대의 값으로 설정합니다 !.
게시판 목록
퍼블리싱강좌
| 번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|---|
| 58 | jQuery Mobile | 8년 전 | 2978 | ||
| 57 | jQuery Mobile | 8년 전 | 2024 | ||
| 56 | jQuery Mobile | 8년 전 | 1353 | ||
| 55 | jQuery Mobile | 8년 전 | 1546 | ||
| 54 | jQuery Mobile | 8년 전 | 2230 | ||
| 53 | jQuery Mobile | 8년 전 | 1527 | ||
| 52 | jQuery Mobile | 8년 전 | 1551 | ||
| 51 | jQuery Mobile | 8년 전 | 1420 | ||
| 50 | jQuery Mobile | 8년 전 | 1308 | ||
| 49 | jQuery Mobile | 8년 전 | 1814 | ||
| 48 | jQuery Mobile | 8년 전 | 1458 | ||
| 47 | jQuery Mobile | 8년 전 | 2014 | ||
| 46 | jQuery Mobile | 8년 전 | 1974 | ||
| 45 | jQuery Mobile | 8년 전 | 1509 | ||
| 44 | jQuery Mobile | 8년 전 | 1670 | ||
| 43 | jQuery Mobile | 8년 전 | 1781 | ||
| 42 | jQuery Mobile | 8년 전 | 1659 | ||
| 41 | jQuery Mobile | 8년 전 | 1829 | ||
| 40 | jQuery Mobile | 8년 전 | 1467 | ||
| 39 | jQuery Mobile | 8년 전 | 1627 | ||
| 38 | jQuery Mobile | 8년 전 | 2174 | ||
| 37 | jQuery Mobile | 8년 전 | 2677 | ||
| 36 | jQuery Mobile | 8년 전 | 2126 | ||
| 35 | jQuery Mobile | 8년 전 | 1514 | ||
| 34 | jQuery Mobile | 8년 전 | 2413 | ||
| 33 | AngularJS | 8년 전 | 2858 | ||
| 32 | AngularJS | 8년 전 | 2426 | ||
| 31 | AngularJS | 8년 전 | 1760 | ||
| 30 | AngularJS | 8년 전 | 2835 | ||
| 29 | AngularJS | 8년 전 | 2387 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기