【发布时间】:2013-06-02 08:13:36
【问题描述】:
仅使用 AngularJS 是否可以检测子域并相应地进行路由?
假设子域 spicy.example.com 指向与 example.com
相同的 docRootexample.com 有一个 index.html,其中住着 <div ng-view></div>
在我的配置中,我定义了部分路由:$routeProvider.when('/food', {templateUrl: 'views/example.com/regular.html'});
但是如果 spicey.example.com 想要用自己的 regular.html 部分覆盖它呢?$routeProvider.when('/food', {templateUrl: 'views/spicy.example.com/hot.html'});
如果不在像 Apache/Nginx 这样的服务器上使用重写规则,这可能吗?
注意:
这是一个单页应用$locationProvider.html5Mode(true);
我正在使用 CORS:$http.defaults.useXDomain = true;
【问题讨论】:
标签: javascript angularjs