angularJS中include的页面的ng-model不能实时存取

框架:angularJS

版本:1.4.2

情况描述:

有一个主页面main.html,它include了另两个页面list.html和content.html,controller指向main.html。在content.html中有一个input使用ng-model实现双向绑定,要在controller中实现对此input中的数据的实时存取。此时,controller中的js不能实现实时存取的功能,使用$watch监视也无效。

解决情况:

可能由于controller指向的是main.html,而不能监控include进来的页面的数据。将content.html合并到main.html中去,问题得到了解决。暂时没找到其他解决办法。

原文地址:https://www.cnblogs.com/ihaveahammer/p/4686329.html