我需要在 AngularJS View 更改时调用几个 JavaScript 函数(占位符回退等)。我怎样才能在全局范围内实现这一目标?
最佳答案
您可以监听路由更改成功事件并调用回调中的函数:
$scope.$on('$routeChangeSuccess', function(next, current) {
// call your functions here
});
关于javascript - 如何在 AngularJS View 更改上调用 JS 函数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20179599/