Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; cronometro has a deprecated constructor in /home/wdrfree/public_html/model/admin/model.php on line 4
AngularJS - Problem & Solutions | wdrfree ▷

AngularJS - Problem & Solutions

Thursday 21th, Jun, 2018 | #HTML 5


Update parent scope variable in angular

app.controller('ctrlParent',function($scope){
    $scope.parentprimitive = "someprimitive";
    $scope.parentobj = {};
    $scope.parentobj.parentproperty = "someproperty";
});
app.controller('ctrlChild',function($scope){
    $scope.parentprimitive = "this will NOT modify the parent"; //new child scope variable
    $scope.parentobj.parentproperty = "this WILL modify the parent";
});