Using ng as a framework, I found a problem when routing. It doesn't work when different pages use different js. I know the reason is that your js needs to get some Dom nodes. But when the homepage is first loaded, my page is not loaded. At this time, these DOM nodes cannot be obtained. Do you have any good solutions?
滿天的星座2017-05-15 17:04:39
The DOM event cannot take effect. There is a live method (jquery on). If the double binding of data fails, $scope.$apply() is manually refreshed. The loading of the DOM node is also related to the location where your js is written. Your question is not clear enough
滿天的星座2017-05-15 17:04:39
A frequently used method, use the $timeout
method:
$timeout(function() {
// TODO
// 这里填写你的功能代码
}, 1000) // 这个时间你可以自己选择
滿天的星座2017-05-15 17:04:39
This problem has been solved. I also encountered it before and struggled with it for a long time. http://www.weipxiu.com/?p=434