Hi,

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.

Script is as below

index.html is as below:

<!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?.

Thanks
Red

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to angular+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/angular/d3c6f82a-0f51-4d12-b561-6006fb6941b4%40googlegroups.com.

Reply via email to