0
如何创建一个模块,该模块具有模板“Hello world”的指令,并在初始化网页的同时将该模块注入到基本模块(应用程序)中,该指令应该编译并附加到<body>
?如何创建一个简单模块来注入应用程序模块?
angular.module('helloWorld',[]).provider(['helloWorld',function(ngModalView){
return{
$get : [function($compile, $scope){
var tem = $compile('<hello-world></hello-world>')($scope);
//append this template to body
}]
};
}]);
angular.module('helloWorld',[]).directive('helloWorld',[function(){
return {
restrict: 'E',
replace: true,
template: '<div style="width=150px;height="150px">Hello world</div>'
};
}]);
我需要在应用程序启动时在模块上运行。
angular.module('app',['helloWorld']);
给我们一些更多的信息或摘要,以供问题附着 – Thaadikkaaran
一个示例代码 – azad
你的意思是模块的延迟加载? – Thaadikkaaran