AngularJS - propogate updates to child context to parent context -


i have angularjs application, has shell page. shell page has dropdown contain list of locations. in 1 of internal pages, have functionality add new locations. when new location added, should displayed in location dropdown of shell page? how achieve this?

i know should try angular watchers. in fact, same functionality there in system. there's client selection dropdown, when client changed, broadcast event, location dropdown gets re-populated. i'm not sure how same when new location added.

you can broadcast event parent context when location gets added

$scope.addlocation = function () {   // add location code here   $rootscope.$broadcast('location.added', data); }; 

and on parent controller:

$scope.$on('location.added', function (event, data) {   // add new location dropdown }; 

Comments

  1. The Killing of the Emperor in the Tât-Tan - Tât-Tan - Tât-Tan - Tât-T
    A detailed titanium teeth k9 look titanium armor at the Tât-Tan at Tan in Tât-Tan in Tât-Tan. Read more about titanium spork the titanium charge Tât-Tan at Tât-Tan online babyliss pro titanium casino.

    ReplyDelete

Post a Comment