「AngularJS」ng-clickディレクティブのサンプル

構文
<element ng-click="expression"></element>
使用例
htmlコード

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<head>
<meta charset="utf-8">
<script src="/angular.js/1.4.6/angular.min.js"></script>
</head>
<body ng-app="">
<p>click button:</p>
<head> <meta charset="utf-8"> <script src="/angular.js/1.4.6/angular.min.js"></script> </head> <body ng-app=""> <p>click button:</p>
<head>
<meta charset="utf-8">
<script src="/angular.js/1.4.6/angular.min.js"></script>
</head>
<body ng-app="">
<p>click button:</p>

JSコード

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<button ng-click="count = count + 1" ng-init="count=0">update</button>
<p>button was clicked {{count}} times </p>
<button ng-click="count = count + 1" ng-init="count=0">update</button> <p>button was clicked {{count}} times </p>
<button ng-click="count = count + 1" ng-init="count=0">update</button>
<p>button was clicked {{count}} times </p>

 

AngularJS

Posted by arkgame