<h1>Example: ngClick</h1>
<p>ngClickはClickイベントをリスナー登録します。</p>
<div ng-app="myApp">
  <div ng-controller="myController">
    <input type="button" value="+1" ng-click="count=count+1">
    <input type="button" value="*2" ng-click="click(2)">
    
    <p>{{ count }}</p>
  </div>
</div>
@import "bourbon";

body {
  padding: 1.5rem;
}
View Compiled
var app = angular.module('myApp', []);

app.controller('myController', ['$scope', function($scope){
  $scope.count = 0; // countの初期化
  $scope.click = function(count){
    $scope.count = $scope.count * count;
  }
}]);

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

  1. https://ajax.googleapis.com/ajax/libs/angularjs/1.3.2/angular.min.js