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

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -