2

Firstly, here is the plnkr.

I has this template working when it was in a single page. But when I tried splitting it up using the ng-include. Suddenly the ng-model stopped updating.

I'm just a beginner in AngularJS.

I'm adding some conditional classes based on the checkbox Boolean value. But right now it's not working.

Did check the docs. But that's seriously not clear for me.

Please let me know on what should I do to update the ng-model when ever I use the ng-include.

Thanks in advance.

Unknown User
  • 3,598
  • 9
  • 43
  • 81

1 Answers1

4

because ng-include creates a new scope, try doing:

ng-model="$parent.hasFixed"

it should work. but there might be a better solution.

sss
  • 1,259
  • 9
  • 23
  • Yes.. it did work. But can say me what's it actually doing? – Unknown User Aug 20 '14 at 07:01
  • here: https://docs.angularjs.org/api/ng/directive/ngInclude ... it says under the "Directive info" section, the directive creates a new scope. So, you created 2 hasFixed property. One from the parent, the other from the child; but you really wanted to update the parent's. – sss Aug 20 '14 at 07:05