I am new to AngularJS and writing a simple script to invoke various functions based on the button clicked. Only Delete function is invoked and the other two functions are not invoked.
<!DOCTYPE html>
<html>
<script src="
https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>
<body>
<div ng-app="myApp" ng-controller="controller1">
Name: <input ng-model="name">
<input type="button" value="insert" ng-click="insert()"/>
<input type="button" value="update" ng-click="update()"/>
<input type="button" value="delete" ng-click="delete()"/>
<br><br><div ng-hide="IsVisible">Angular</div>
</div>
</body>
<script type="text/javascript" src="index.js"></script>
</html>
----------------------------------------index.js-------------------------------------------
var app = angular.module('myApp', []);
app.controller('controller1', function($scope) {
$
scope.name = "John Doe";
});
app.controller('controller1',function($scope){
$scope.IsVisible = false;
$scope.insert = function(){
$scope.IsVisible = $scope.IsVisible = true;
alert('insert called');
}
});
app.controller('controller1',function($scope){
$scope.IsVisible = false;
$scope.update = function(){
$scope.IsVisible = $scope.IsVisible = true;
alert('update called');
}
});
app.controller('controller1',function($scope){
$scope.IsVisible = false;
$scope.delete = function(){
$scope.IsVisible = $scope.IsVisible = true;
alert('delete called');
}
});
Any idea what's wrong with this please?.