javascript - Angular JS - Is there any way to dynamically select templates -
i have problem angularjs router function:
how can dynamically take templates app.
i have app drive 'its api's'
. api's contains 'template info along them'.
for illustration api:
[{ "rootname" : "home1", "pagetitle" : "home1", "templatename" : "template_home_1" }, { "rootname" : "home2", "pagetitle" : "home2", "templatename" : "template_home_2" }, { "rootname" : "home3", "pagetitle" : "home3", "templatename" : "template_home_2" }]
the reason reuasbility, , flexibility selection ui's.
how can angular. there way dynamically select templates.
my router goes this:
demoapp.config(function($routeprovider){ $routeprovider .when('/mainpage/:pageid', { controller:'mainpagecontroller', template : function (pageid) { //this info avilable @ api } }) .otherwise({redirectto:'/mainpage/home'}); });
you can utilize templateurl, , create server serve template,
.when('/mainpage/:pageid',{templateurl:'/tpl/:pageid'})
you can modify templates on serverside. server pick route , decide templates display.
javascript angularjs angularjs-directive angularjs-ng-repeat angular-ui
No comments:
Post a Comment