Scoping scope (Mini-challenge 2) Answer


Check out Mini-challenge 2 Instructions


To scoping the scope and avoid this behavior, one solution is to create an object inside the scope instead of call the property scoping scopedirectly from the scope, like this: $scope.obj.myProp (see code below).


myApp.controller('navCtrl', function ($scope) {
    $scope.obj = {};

In the view:

<div ng-controller="navCtrl">
   <div>navCtrl text: {{}}</div>
   <div ng-controller="loginCtrl">
        <div> loginCtrl text: {{}}</div>
        <input ng-model=""></input>


Here are other recommendations and references.:
You can find more information about the angularjs scope and the Prototypal Inheritance here.

If you have a solution for this challenge, different from the proposal solution on this post, don’t be shy and share it with us. 🙂