Hey, Thanks for you reply.

Yes, you right! it's a good practice get data from server. But how can i do 
that?

See my table:

<table class="table table-hover">
<thead>
<tr>
<th>id</th>
<th>description</th>
<th>actions</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="position in vm.positions">
<td>{{position._id}}</td>
<td>{{position.description}}</td>
<td>
<div class="btn-group" role="group" aria-label="">
  <a ui-sref="editPosition({id: positions._id})" class="btn btn-default"><i 
class="glyphicon glyphicon-pencil"></i></a>
  <a ui-sref="home" class="btn btn-default" 
ng-click="vm.remove(position._id)"><i class="glyphicon 
glyphicon-trash"></i></a>
</div>
</td>
</tr>
</tbody>
</table>

 

Em sábado, 18 de julho de 2015 20:09:40 UTC-3, fasfsfgs escreveu:
>
> Forgive me if I'm wrong but I think a good practice is to get this single 
> item again from the server since this route could be accessed without going 
> thru the list first.
>
> If you don't want to do that for whatever reason, you could make your edit 
> route a child from your list route.
> Then they could share data between their controllers or using resolve in 
> an abstract state on top of them.
> I actually had to do this once. Let me know if you need me to elaborate on 
> this.
> (I'm assuming you are using ui-router. Not sure if it's possible to do 
> this with angular's router.)
>
> It would be nice to see some more ideas from other users as well.
>
> On Sat, Jul 18, 2015 at 7:48 PM, Leonan Luppi <[email protected] 
> <javascript:>> wrote:
>
>> Hello,
>>
>> How can i get data from ng-model when i call new route.
>>
>> Example:
>>
>> I have a product CRUD (Create, read, update, delete) and two page, one 
>> display <table> with datas and other to edit my single data (that I'll 
>> select).
>>
>> On <table> tag, i have a route that redirect to edit page, how can i get 
>> the row data and display in my edit page at inputs?
>>
>> -- 
>> 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] <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> 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