Angular js custom domain mapping

ぃ、小莉子 提交于 2019-12-11 07:29:23

问题


I want to give the users on my portal to have their domains mapped to their page and internal pages from their on.

So, the user site url http://www.username.com should map to http://example.com/userid, similarly all the links inside should also map. Like, http://www.user-id.com/page1 => http://example.com/userid/page1 http://www.user-id.com/section1/page1 => http://example.com/userid/section1/page1

Has some body done this in angular js? I am using angular 1.3 and open to move to 1.4 or 1.5


回答1:


Here is an example router setup with ui-router that could match what you are attempting:

// APPLICATION ROUTES
        // -----------------------------------
        // For any unmatched url, redirect to /app/
        $urlRouterProvider.otherwise("/login/signin");
        //
        // Set up the states
        $stateProvider.state('app', {
            url: "/app",
            templateUrl: "views/app.html",
            resolve: loadSequence('any library you want'),
            abstract: true
        }).state('app.page1', {
            url: "/page1",
            templateUrl: "views/page1.html",
            resolve: loadSequence('any library you want'),
            title: 'Dashboard'
        }).state('app.page1.section1', {
            url: '/page2',
            template: '<div ui-view class="fade-in-up"></div>',
            title: 'Page 2',
     });


来源:https://stackoverflow.com/questions/36085246/angular-js-custom-domain-mapping

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!