Luca
Luca

Reputation: 19

Token 'x.id' is unexpected, expecting [:] at column 11 of the expression [elimina({{x.id}})] starting at [x.id}})]

Getting error :

Error: [$parse:syntax] Syntax Error: Token 'x.id' is unexpected, expecting [:] at column 11 of the expression [elimina({{x.id}})] starting at [x.id}})].

This is the code:

<tr ng-repeat="x in lista | filter:cerca | orderBy:option" class="{{x.class}}">
    <td>{{x.nome}}</td>
    <td>{{x.cognome | uppercase}}</td>
    <td>{{x.data | date:'dd-MM-yyyy'}}</td>
    <td><a href ng-click="elimina({{x.id}})">Elimina</a></td>
</tr>

If I set up a manual number to elimina(id) it works, but with the expression {{x.id}} inside the ng-repeat it doesn't. Why?

Thanks

Upvotes: 1

Views: 973

Answers (1)

gaurav bhavsar
gaurav bhavsar

Reputation: 2043

No need to use {{}} inside ng-click

use like this :

<td><a href ng-click="elimina(x.id)">Elimina</a></td>

Upvotes: 5

Related Questions