Vincent
Vincent

Reputation: 6188

parameter in function of ng-click not found

I have the following code:

<a href ng-click='navigateTo("/blog/1000")'>
    {{ blog.blogId}} 
</a>

<a href ng-click='navigateTo("/blog/{{ blog.blogId}}")'>
    {{ blog.blogId}}
</a>

navigateTo is a function to change $location.path() and save some data.

Both hrefs have the same html output, yet only the top one works. Why is this?

Upvotes: 0

Views: 61

Answers (1)

AlwaysALearner
AlwaysALearner

Reputation: 43947

Dont use interpolation inside ngClick:

<a href ng-click='navigateTo("/blog/"+blog.blogId)'>

Upvotes: 2

Related Questions