I am having hard time calling callback function inside ng-click under ng-repeat. Below is the snippet.
It is calling the ng-click function but when it is time to call the callback function - it fails - undefined - cb is not a function message
HTML part
<div ng-repeat="item in items">
<span ng-click="itemClick(cb)">{{item}}</span>
</div>
Javascript
....
<script type="text/javascript">
function cb(){
alert('Hey');
}
</script>
Angular
...
$scope.itemClick = function(cb) {
cb();
};
I am new to angular.
itemClick(item)
is what you maybe want to achieve. – Johannes Jander Dec 17 '15 at 9:59