parent scope not getting updated in angularjs -
i having 2 controllers -
parent controller
dashboardapp.controller("parentcontroller", ['$scope', function($scope){ $scope.rootrules = {blackrule: "", bluerule: "", greenrule: "", yellowrule: "", orangerule: "", redrule: ""}; so can see has variable called rootrules updating in child controller -
child controller
var color = $scope.color + "rule"; $scope.rootrules[color] = rulestring; console.log($scope.rootrules); so works when rootrules having "" color when rootrules have string stored in color unable see updates on screen code. please let me know if full code required.
thanks in advance.
you can access , modify parent scope this:
$scope.$parent.rootrules[color] = rulestring; more in depth answer here: https://stackoverflow.com/a/21454647/3858736
Comments
Post a Comment