Data-binding arguments of a function with AngularJS in ng-click


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({{}})"></div>

HTML snippet not being processed from angular:

<div ng-click="goToNotif("></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("></div>

In main.js –

var app = angular.module('MyApp', []);

app.controller('MainCtrl', function($scope) {
$scope.go = function() {
//write code here.

Answered By – Manvi

Answer Checked By – Gilberto Lyons (AngularFixing Admin)

Leave a Reply

Your email address will not be published.