I am new to angular. I have two button as I will click on button1 so its color will be change from green to red and after that I will click on button2, so button1 color will be again green. How I can do it using ng-click ?
Its my index.html
<!DOCTYPE html>
<html ng-app="myApp">
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.7/angular.min.js"></script>
<script type="text/javascript" src="app.js"></script>
<title></title>
</head>
<body ng-controller ="testCtrl" >
<button type="button" class="btn btn-default" ng-click="chngcolor()" >Chnage Color</button>
<button type="button" class="btn btn-default" ng-click="chcolor()" >Pre Color</button>
</body>
</html>
and this is my app.js
var myApp = angular.module("myApp",[]);
myApp.controller('testCtrl', function($scope){
$scope.chngcolor = functionn{
};
});
Which code should i write in app.js ?