+1 for ng-click!

On Saturday, February 22, 2014 2:37:38 AM UTC-5, Luke Kende wrote:
>
> Have you tried ng-click?
>
> <tr ng-click="goTo(res.id)" style="pointer:cursor">
>          <td>{{res.id}}</td>
>         <td>{{res.ragioneSociale}}</td>
>         <td>{{res.indirizzo}}</td>
>         <td>{{res.codiceFiscale}}</td>
>         <td>{{res.tipoSocieta}}</td>
>         <td>{{res.attivita}}</td>
> </tr>
>
> $scope.goTo = function (id){
>   location.href = '/somewhere/' + id ;
> }
>
> On Friday, February 21, 2014 11:37:03 AM UTC-7, Vanya Dineva wrote:
>>
>> Hi Mauro,
>>
>>
>> first of all you forgot to close the double quotes for the ng-href:
>>    <a ng-href="/somwhere/{{res.id}}>
>> should be 
>>    <a ng-href="/somwhere/{{res.id}}">
>>
>> Second, <a> element as a direct descendent of a <tr> is not valid html. 
>> Try instead to have the contents of each <td> in the <tr> wrapped in a link:
>>
>> <tr ng-repeat="res in result">
>>         <td><a ng-href="/somwhere/{{res.id}}"> 
>> {{res.id<http://www.google.com/url?q=http%3A%2F%2Fres.id&sa=D&sntz=1&usg=AFQjCNEvV3yPedZR4nPvYD-bv4XSye2nxg>}}
>>  
>> </a></td>
>>         <td><a ng-href="/somwhere/{{res.id}}"> {{res.ragioneSociale}} 
>> </a></td>
>>         <td><a ng-href="/somwhere/{{res.id}}"> {{res.indirizzo}} 
>> </a></td>
>>         <td><a ng-href="/somwhere/{{res.id}}"> {{res.codiceFiscale}} 
>> </a></td>
>>         <td><a ng-href="/somwhere/{{res.id}}"> {{res.tipoSocieta}} 
>> </a></td>
>>         <td><a ng-href="/somwhere/{{res.id}}"> {{res.attivita}} </a></td>
>> </tr>
>>
>>
>> Hope this solves your problem
>>
>>
>>
>>
>> On Friday, February 21, 2014 11:53:48 AM UTC-5, Mauro Cacicia wrote:
>>>
>>> hi guys, i'm new with angular and i have this problem,
>>> i need to use ng-href on one entire table row created with ng-repeat, to 
>>> be more clear i need to do something like that:
>>>
>>>
>>> <tr ng-repeat="res in result">
>>>     <a ng-href="/somwhere/{{res.id}}>
>>>         <td>{{res.id}}</td>
>>>         <td>{{res.ragioneSociale}}</td>
>>>         <td>{{res.indirizzo}}</td>
>>>         <td>{{res.codiceFiscale}}</td>
>>>         <td>{{res.tipoSocieta}}</td>
>>>         <td>{{res.attivita}}</td>
>>>     </a>
>>>    </tr>
>>>
>>>
>>> i really need to use the ng-href because part of the url have to change 
>>> dinamically in base at what row will be clicked.
>>> thanks
>>>
>>>

-- 
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/groups/opt_out.

Reply via email to