I am new to AngularJs and trying to load template on the basis of Id
in angular route.
Here is my route :
angular.module('myApp', [])
.state('template', {
url:'/template/{id}',
templateUrl: 'views/pages/template_main.html',
controller: 'TemplateController',
resolve: {
loadMyDirectives:function($ocLazyLoad){
return $ocLazyLoad.load(
{
name:'myApp',
files:[
'scripts/directives/template1/template1.js',
]
})
}
}
})
How can I achieve this?
if id==1
then it will load this: 'scripts/directives/template1/template1.js'
if id==2
then it will load this: 'scripts/directives/template1/template2.js
'
How can I make conditions in route. Any suggestions?