ui-router使用路由调用绝对路径template

来源:互联网 发布:淘鹊桥是淘宝的吗 编辑:程序博客网 时间:2024/06/06 04:36
(function() {    'use strict';    angular.module('cms').config(route);    route.$inject = ['$routeProvider'];    function route($routeProvider) {        $routeProvider            .when('/:section', {                templateUrl: buildPath            })            .when('/:section/:page', {                templateUrl: buildPath            })            .when('/:section/:page/:task', {                templateUrl: buildPath            });    }    function buildPath(path) {        var layout = 'layout';        angular.forEach(path, function(value) {            value = value.charAt(0).toUpperCase() + value.substring(1);            layout += value;        });        layout += '.tpl';        return 'client/app/layouts/' + layout;    }})();
0 0
原创粉丝点击