Synchronously registering a decoratorAngular:为什么延迟加载装饰器不起作用?
angular
.module('myApp')
.decorator('$controller', MyDecorator);
angular
.module('myApp')
.controller('MyCtrl', MyCtrl);
Asynchronously registering a decorator
$timeout(function() {
angular
.module('myApp')
.register
.decorator('$controller', MyDecorator);
// Make sure controller is registered after decorator
$timeout(function() {
angular
.module('myApp')
.register
.controller('MyCtrl', MyCtrl);
}, 1000);
}, 1000);
为什么没有第二个例子中工作?
什么不行?什么是错误信息? “MyDecorator”做了什么,它在哪里使用? – Bergi
Angular不支持延迟加载的组件。你可以看看[ocLazyLoad](https://github.com/ocombe/ocLazyLoad)。 – zeroflagL
@Bergi没有错误,它只是不运行 –