加载所有翻译后启动 Angular.js route-segment 或 ui-router
Start Angular.js route-segment or ui-router after all translations are loaded
有什么办法,如何在 translateProvider 加载其翻译后立即启动 ui-router 或 route-segment?
我正在使用 pascal prechts translate filter 和 bind once {{:: }} 表示法。在本地主机上它工作得很好,但是当我在远程服务器上测试它时,绑定一次会在翻译字符串之前更快地删除观察者。
所以我想知道是否有什么方法可以稍微延迟路由。
尝试检查本机内置功能:
$urlRouterProvider.deferIntercept(defer)
Disables (or enables) deferring location change interception.
If you wish to customize the behavior of syncing the URL (for example, if you wish to defer a transition but maintain the current URL), call this method at configuration time. Then, at run time, call $urlRouter.listen()
after you have configured your own $locationChangeSuccess
event handler.
检查一些类似的问题:
- AngularJS - UI-router - How to configure dynamic views
在其中一个链接 observe this plunker 中,此功能的用法如下:
在.config()
阶段停止等待:
.config(['$urlRouterProvider' ...,
function($urlRouterProvider, ...) {
// defer execution in config phase
$urlRouterProvider.deferIntercept();
...
稍后在 .run()
阶段打开 url 处理
.run(['$urlRouter' ...,
function($urlRouter...) {
...
$http
.get("modules.json")
.success(function(data) {
// do some stuff
// re-enable UI-Router url stuff
$urlRouter.sync();
$urlRouter.listen();
});
有什么办法,如何在 translateProvider 加载其翻译后立即启动 ui-router 或 route-segment?
我正在使用 pascal prechts translate filter 和 bind once {{:: }} 表示法。在本地主机上它工作得很好,但是当我在远程服务器上测试它时,绑定一次会在翻译字符串之前更快地删除观察者。
所以我想知道是否有什么方法可以稍微延迟路由。
尝试检查本机内置功能:
$urlRouterProvider.deferIntercept(defer)
Disables (or enables) deferring location change interception.
If you wish to customize the behavior of syncing the URL (for example, if you wish to defer a transition but maintain the current URL), call this method at configuration time. Then, at run time, call
$urlRouter.listen()
after you have configured your own$locationChangeSuccess
event handler.
检查一些类似的问题:
- AngularJS - UI-router - How to configure dynamic views
在其中一个链接 observe this plunker 中,此功能的用法如下:
在.config()
阶段停止等待:
.config(['$urlRouterProvider' ...,
function($urlRouterProvider, ...) {
// defer execution in config phase
$urlRouterProvider.deferIntercept();
...
稍后在 .run()
阶段打开 url 处理
.run(['$urlRouter' ...,
function($urlRouter...) {
...
$http
.get("modules.json")
.success(function(data) {
// do some stuff
// re-enable UI-Router url stuff
$urlRouter.sync();
$urlRouter.listen();
});