In
this article I am going to explain how to implement button click event in Angularjs.
Description:
AngularJs
is one of most popular Javascript framework. I want to fire button click event.
We use ng-click directive of angularjs to call an event of button click.
Implementation:
Here
I am going to create example. On button clicks want to show message in popup.
HTML Markup:
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular.js"></script>
<script>
var angular = angular.module('mvcapp', []);
angular.controller('DemoController', function ($scope, $http) {
$scope.Buttonfire = function () {
alert('Button Click Fired!!')
}
});
</script>
</head>
<body>
<div ng-app="mvcapp" ng-controller="DemoController">
<input type="button" value="Save" ng-click="Buttonfire()" />
</div>
</body>
</html>
0 Comments