how to load component with templateUrl?

Posted in General by zzsoszz Wed Oct 19 2016 05:17:03 GMT+0000 (Coordinated Universal Time)·1·Viewed 1,453 times

could you give me demo ?
Oct 19, 2016

main.js

mainApp.constant("Modules_Config",[
{
name:"qmicrocourse",
module:true,
files:[
baseUrl+"js/app/qmicrocourse/controller.js"
]
},
{
name:"qselectcourse",
module:true,
files:[
baseUrl+"js/bower_components/qselectcourse/1.0.0/plugin.js",
baseUrl+"js/bower_components/qselectcourse/1.0.0/plugin.css",
]
},
{
name:"qselectthought",
module:true,
files:[
baseUrl+"js/bower_components/qselectthought/1.0.0/plugin.js",
baseUrl+"js/bower_components/qselectthought/1.0.0/plugin.css",
]
},
{
name:"qarticle",
module:true,
files:[
baseUrl+"js/bower_components/qarticle/1.0.0/plugin.js",
baseUrl+"js/bower_components/qarticle/1.0.0/plugin.css",
]
},
{
name:"qcoursegroup",
module:true,
files:[
baseUrl+"js/bower_components/qcoursegroup/1.0.0/plugin.js",
baseUrl+"js/bower_components/qcoursegroup/1.0.0/plugin.css",
]
}
]).config(["$ocLazyLoadProvider","Modules_Config",routeFn]);
function routeFn($ocLazyLoadProvider,Modules_Config){
$ocLazyLoadProvider.config({
debug:true,
events:true,
modules:Modules_Config
});
};

demo.html
mainApp.controller("mainController", function ($rootScope,$http,$location,$scope,$ocLazyLoad) {
$ocLazyLoad.load("qcoursegroup");
});

<body ng-app="mainApp">

<div ng-controller="mainController">
{{idarray}}
<qcoursegroup >
</qcoursegroup>
</div>
</body>

component.js
module.component('qcoursegroup', {
transclude: true,
scope:true,
bindings: {
ngModel: '=',
},
templateUrl:baseUrl+'js/bower_components/qcoursegroup/1.0.0/plugin.html',
controller: ["qcoursegroupService",'$scope','$ocLazyLoad',function(service, $scope,$ocLazyLoad) {

        }]

});
  
Markdown is allowed