var app = angular.module('plunker', []);
app.controller('MainCtrl', function($scope) {
$scope.name = 'World';
});
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>What is ngClick directive? Why we use it?</title>
<script src="https://code.angularjs.org/1.4.1/angular.js"></script>
<script>
var app = angular.module('myApp', []);
app.controller('ngClickCtrl', function($scope) {
$scope.firstName = "Anil";
$scope.lastName = "Singh";
$scope.IsActive = false;
$scope.AddName = function() {
$scope.IsActive = true;
};
});
</script>
</head>
<body ng-app="myApp">
<h3>What is ngClick directive? Why we use it?</h3>
<div ng-controller="ngClickCtrl">
<div>
First Name:
<input type="text" ng-model="firstName"> Last Name:
<input type="text" ng-model="lastName">
<div ng-show="IsActive">
<h3>Full Name: {{firstName + " " + lastName}} </h3></div>
</div>
<div>
<button ng-click="AddName()">Display for ngClick FullName</button>
<br/>
<button ng-dblClick="AddName()">Display for ngDbClick FullName</button>
<br>
<button ng-mousedown="AddName()">ng-mousedown on this Button </button>
<br>
</div>
</div>
</body>
</html>
/* Put your css in here */