I have two functions with same name "chiliClick". The uncommented function is not invoking even after hitting the button chili nor is it throwing any error in console. However the same function (commented) working fine with same code. Is there any difference? Please help
(function(){
var app = angular.module("myApp", []);
var clickController = function($scope){
$scope.spicy = 'very';
function chiliClick(){
$scope.spicy = 'chili';
}
// $scope.chiliClick = function(){
// $scope.spicy = 'chili';
// }
};
app.controller("clickController", clickController);
}());// Code goes here
<!DOCTYPE html>
<html lang="en" ng-app="myApp">
<head>
<meta charset="UTF-8">
<title>Hello Controller </title>
</head>
<body>
<div ng-controller="clickController">
<button ng-click="chiliClick()">Chili</button>
<button>jalapeño</button>
<p> this is {{spicy}} hot <p>
</div>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.4.1/angular.min.js"></script>
<script src="myApp.js"></script>
</body>
</html>
What are the differences between the declarations of function "chiliClick"?