需要一个文件夹进行路由,使该文件夹中的所有包含可用

时间:2017-09-29 05:43:51

标签: angularjs routes

大家好我需要实际路由一个文件夹,里面会包含多个文件和文件夹。

For example 
My folder name is Contains -- with inner folder  sample1 sample2.
sample1 folder contains --  app.js index.js Index.html 
sample2 folder contains --  app.js index.js Index.html

so I want routes for like every file in each folder's 
example --  localhost:3030/Contains/sample1/Index.html
localhost:3030/Contains/sample2/Index.html
localhost:3030/Contains/sample1/index.js
localhost:3030/Contains/sample1/app.js
... etc 

如何使用stateProvider实现此目的?

提前致谢

1 个答案:

答案 0 :(得分:0)

我在这里理解你的问题我正在使用三级嵌套

var app = angular.module("Appp", ['ui.router']);
    app.config(function($stateProvider, $urlRouterProvider) {
        $stateProvider
            .state('userSetting', {
                url: '/userSetting',
                templateUrl: 'templates/userSetting.html'
            })
            .state('settings.profile.user', {
                url: '/profile',
                templateUrl: 'templates/profile.html',
                controller: 'ProController'
            })
            .state('settings.account.user', {
                url: '/account',
                templateUrl: 'templates/account.html',
                controller: 'AccController'
            });
        $urlRouterProvider.otherwise('/userSetting/profile');
    });