0

I want to set value into ns-click dynamically, i mean that:

<td ng-click="{{schedule.action}}" ng-init="schedule.action=schedule.action" ng-repeat="schedule in room.Schedule">{{schedule.firstName}}</td>

i'm getting the following error message:

Error: [$parse:syntax] Syntax Error: Token '{' invalid key at column 2 of the expression [{{schedule.action}}] starting at [{schedule.action}}].

How to solve this problem?

zura katsitadze
  • 307
  • 2
  • 6
  • 15

1 Answers1

0

ng-click directive will not interpolation directive {{}} in it, that will throw $parser exception. Basically it can have function call, or code dealing with scope variables.

Markup

<td ng-click="someMethod()" ng-init="schedule.action=schedule.action" 
  ng-repeat="schedule in room.Schedule">
    {{schedule.firstName}}
</td>
Pankaj Parkar
  • 134,766
  • 23
  • 234
  • 299