firebase - How to optimise data retrieval and inter-controller data sharing with AngularFire automatic binding? -


I have to say

  1. A list view + controller that lists the list of item names and < / Li>
  2. A description view + Controller shows detail for the past item

    I do not get data twice or twice, the way (automatic Will automatically use the angularifier with three-way binding?

    Because the controller # 1 has already received the item and their details when (ItemsListRef). $ Bind ($ scope, 'item'); executes the statement in Controller # 2, (itemDetailRef). $ Bind ($ diameter, 'item dिपate') will then get item details data which has already been brought to controller # 1

    An option that comes to mind: one angel The service can be used once to bring the data of objects and then the data can be shared between the controllers, but I am not sure whether the three-way automatic binding angle, or if it Your thoughts / suggestions on this Land? Any other options? What will be the recommended way to handle it?

    Firebase client is smart enough to use a local cache if it exists Firebase Example each base The firebase is singleton for the URL, so attaching different audiences on different paths in the same firebase will result in not results in unnecessary network activity.

    I use a $ Firebase reference in a service, and then using a 3-way data bind for an item's description in a controller. For example:

      var myapp = angular.module ("myapp", ["firebase"]); Myapp.factory ("item service", ["$ firebase", function ($ firebase) {return $ firebase (items list rf);}]); Myapp.controller ("detailctrl", ["$ scope", "itemservice", function ($ scope, item) {item. $ Child (itemId). $ Bine ($ diameter, 'itemDetail');}]);    

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -