0

I have a child controller used two times in a page.

When a function is called from the HTML within the child controller, that function (in this child controller) is called correctly, but there is a scope variable update in that function. When the scope variable is updated, the corresponding html code is not updated. Does anyone know why this is happening?

Here is my HTML:

<div ng-controller="projectResourceManagementCtrl" class="view-content my-switch-animation">
  <div id="project-list-sortby-container" ng-controller="childController"> 
    <select ng-change="functionInChildCtr()">
  </div>
</div>

<div ng-include="'tpl.html'" ng-controller="childController"></div>
Strikers
  • 4,698
  • 2
  • 28
  • 58
jsbuff
  • 11
  • 3
  • Most probably scoping issue. Please share your html, and do yourself a favor and read https://github.com/angular/angular.js/wiki/Understanding-Scopes – Chandermani Mar 24 '15 at 07:13
  • Just put that scope variable into an object in scope not directly in scope, this way the value will be added in inheritance chain, and will be available for the parent. – AndreiC Mar 24 '15 at 07:20
  • need to know more 1)is your scope variable a primitive or an object.2)in which controllers scope is your html code that needs to be updated.go through this to get a larger picture http://stackoverflow.com/questions/14049480/what-are-the-nuances-of-scope-prototypal-prototypical-inheritance-in-angularjs – Divya MV Mar 24 '15 at 07:20
  • The html is in child controller scope – jsbuff Mar 24 '15 at 07:36
  • My variable is a primitive. Now I made that as an object. As you said the variable is updating correctly, but still html is not updated. – jsbuff Mar 24 '15 at 08:58

0 Answers0