That's actually one of the major gotchas in current angular code, which is
why they're working on improving the syntaxes. There's time when you need
{{}} interpolation, time when you don't and there's one place where I end
up having to do something like ng-something="'something'". I forget where
in my code that is, but it's because the syntax expects a javascript thing,
but I just want to pass in a string. It took me a while to realize it was
treating the thing I passed in as a variable, and then getting undefined
rather than the string constant I wanted.

e

On Wed Nov 19 2014 at 7:32:49 AM Carlos Saludes <[email protected]>
wrote:

> Ok... pretty simple... I feel like an idiot.
>
> Thank you Eric.
>
> El miércoles, 19 de noviembre de 2014 16:26:54 UTC+1, Eric Eslinger
> escribió:
>>
>> Did you try a ng-click="showDetail(user.id)"? I am pretty sure the
>> ng-click syntax doesn't do brace interpolation.
>>
>> e
>>
>> On Wed Nov 19 2014 at 7:20:10 AM Carlos Saludes <[email protected]>
>> wrote:
>>
> Hi!
>>>
>>> I need to show a users list through restful. I got the json data and I
>>> use this code to show de content:
>>>
>>> <div ng-repeat="user in users"><a ng-click="showDetail($index)">{{
>>> user.name }}</a></div>
>>>
>>> This code works fine, but when I click in "showDetail", I want to get
>>> the user id (user.id), not the index.
>>>
>>> If i set:
>>>
>>> <div ng-repeat="user in users"><a ng-click="showDetail({{ user.id
>>> }})">{{ user.name }}</a></div>
>>>
>>> The app says: you failed noob. How can I send the user.id on the
>>> showDetail function?
>>>
>>> Thank you.
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "AngularJS" group.
>>>
>> To unsubscribe from this group and stop receiving emails from it, send an
>>> email to [email protected].
>>> To post to this group, send email to [email protected].
>>
>>
>>> Visit this group at http://groups.google.com/group/angular.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>  --
> You received this message because you are subscribed to the Google Groups
> "AngularJS" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/angular.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to