Call function from ng-click
Description
The following code shows how to use . Call function from ng-click
Example
<!DOCTYPE html>
<html ng-app>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.js"></script>
</head><!--from w w w.ja v a 2s . c o m-->
<body ng-app="myApp">
<div ng-controller="MyCtrl">
<a ng-click="myName('jz')">Click me</a>
</div>
<script type='text/javascript'>
var myApp = angular.module('myApp',[]);
//myApp.directive('myDirective', function() {});
//myApp.factory('myService', function() {});
function MyCtrl($scope) {
$scope.myName = function(name) {
console.log('Hello ' + name);
}
}
</script>
</body>
</html>