Angular JS - Exposing Controller Function outside the module via onClick function call
Exposing Controller Function outside the module via onClick function call
For re-using already defined onClick functions
HTML
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css">
<div ng-app="demo">
<div ng-controller="democtr">
<p> add js value together: {{a}} +{{b}} ={{a + b}}</p>
<input type="number" ng-model="a">
<input type="number" ng-model="b">
</div>
<div ng-controller="democtr">
<p> add js value together: {{a}} +{{b}} ={{a + b}}</p>
<input type="text" ng-model="a">
<input type="text" ng-model="b">
</div>
</div>
JavaScript
angular.module('demo', [])
.controller('democtr', function($scope) {
$scope.a = 1;
$scope.b = 2;
});