I am using ng-click to call a function with arguments I get from the $scope. Unfortunately either are the arguments not processed from angular or I get this error:
Error: [$parse:syntax] Syntax Error: Token ':' not a primary expression at column 1 of the expression [:notification] starting at [:notification].
HTML snippet that results in error:
<div ng-click="goToNotif({{notification.id}})"></div>
HTML snippet not being processed from angular:
<div ng-click="goToNotif(notification.id)"></div>
IMPORTANT: notification
is parsed from a repeat
<div(ng-repeat="notification in notifications")></div>
Here is the code for index.html, define "notifications" seperately -
<div ng-app="MyApp">
<div ng-controller="MainCtrl">
<div(ng-repeat="notification in notifications")>
<div ng-click="go(notification.id)"></div>
</div>
</div>
</div>
In main.js -
var app = angular.module('MyApp', []);
app.controller('MainCtrl', function($scope) {
$scope.go = function() {
//write code here.
}
});