javascript - Angular and passing objects between controllers -
i in progress of making angularjs app c# web api.
i have controller , b.
in controller a, have list of objects, when click add (between 2 list items), controller b.
//add item $location.path("/controllerb")
inside controller b prestented list of objects, when select, need selected item, appear in controller a's list, @ sepcified index.
my approach far:
localstorage: use localstorage store selected object, accessible controller a, need index, , if store in ls access controller b, im headed down path of bad decisions feel :d
so best guess far:
1. save index controller in local storage. (go b)
2. save selecteditem controller b in local storage. (go a)
3. push selecteditem index.
so please, point me in angular direction.
consider using angular service hold data, inject service in controller , controller b.
have @ topic:
what's correct way communicate between controllers in angularjs?
Comments
Post a Comment