(function(){ var tempVersion = new Date().getTime(); angular.module("app.home") .config(['$stateProvider',"$urlRouterProvider",function ($stateProvider,$urlRouterProvider) { var menu = "home",html = ["home","main","demolist"]; $stateProvider.state(menu,{ url:"", templateUrl: '/template/menu/collect.html?r='+tempVersion, controller: "collectCtrl" }); html.forEach(function(h){ $stateProvider.state('home.' + h,{ url:"/" + menu + "/" + h, views:{ "home@":{ templateUrl: "/template/" + menu + "/" + h + '.html?r='+tempVersion, controller: h +"Ctrl" } } }); }); }]); })();