I have a restful service that returns an order. This order has a list of items. I'm making the screen where you can edit a specific item from an order. so I need to have the list of items before I can find and display the info for the specific item. I'm solving it like this:
$scope.order = orderResource.get({id:$routeParams.orderId}, function(order) {
$scope.item = _.findWhere(order.items, {id:$routeParams.itemId});
});
And the binding looks like this:
<input id="itemName" type="text" ng-model="item.name">
My question is: is this the best way to solve this problem? (I don't want to use a route with a resolve.)
Yes, you should make an endpoint that will return a specific item. An example GET endpoint could be
/orders/:id/items/:itemId
$scope.item = orderResource.get({id:$routeParams.orderId, itemId: $routeParams.itemId});
If that is not possible what you are doing seems fine.