Created
May 30, 2014 04:23
-
-
Save phi-jp/f556a8148a7be60c3d7e to your computer and use it in GitHub Desktop.
[AngularJS][tips] Toggle ボタン作ってみた ref: http://qiita.com/phi/items/2a59ccd83006e9209494
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ng-click="hoge=!hoge" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html ng-app> | |
<head> | |
<meta charset="UTF-8" /> | |
<title>AngularJS Sample</title> | |
<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css"> | |
<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap-theme.min.css"> | |
<script src="http://code.angularjs.org/1.2.0-rc.2/angular.min.js"></script> | |
<style> | |
body { | |
padding: 50px; | |
} | |
</style> | |
<script> | |
function SampleCtrl($scope) { | |
$scope.flag = true; | |
}; | |
</script> | |
</head> | |
<body> | |
<div ng-controller="SampleCtrl" class="container"> | |
<button class="btn btn-info btn-lg" ng-click="flag=!flag" ng-class="{open:flag}">{{flag}}</button> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment