ng-click requires ng-model
HTML
<body ng-app="myApp">
<div ng-controller="SampleController">
<h3>My Locations</h3>
<div ng-repeat="option in myOptions">
<input type="checkbox" ng-click="helloWorld()" />
<span>{{ option.desc }}</span>
</div>
</div>
</body>
JavaScript
var myApp = angular.module('myApp',[]);
function SampleController($scope) {
$scope.myOptions = [
{id: 1, desc: 'Option 1'},
{id: 2, desc: 'Option 2'},
{id: 3, desc: 'Option 3'},
{id: 4, desc: 'Option 4'}
];
$scope.helloWorld = function() {
alert('Hello World');
};
}
myApp.directive('input', function () {
return {
restrict: 'E',
require: 'ngModel',
link: function (scope, elm, attr, ngModel) {
// Do nothing
}
};
});