javascript - How to load different templates in angular route on the basis of some conditions -
i new angularjs , trying load template on basis of id
in angular route.
here 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 achieve this?
if id==1
load this: 'scripts/directives/template1/template1.js'
if id==2
load this: 'scripts/directives/template1/template2.js
'
how can make conditions in route. suggestions?
Comments
Post a Comment