Angular2.0.0-rc1异步路由器 [英] Angular2.0.0-rc1 async routers

查看:66
本文介绍了Angular2.0.0-rc1异步路由器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

随着2016年5月(RC1)的最新更改,现在有 @Routes ,不再有 @RouteConfig ,我可以在其中使用 newAsyncRoute 为了异步加载组件.

With latest changes from May 2016 (RC1) there is now @Routes, no more @RouteConfig where I could have used newAsyncRoute in order to async load the component.

Angular.io上的文档尚未准备就绪,任何人都知道如何现在将异步路由器与新路由一起使用,例如在这种情况下:

The documentation is not yet ready at Angular.io, anybody knows how to use async router now with new routing, like in this case:

@Routes([
        { path: '/first', component: FirstComponent },
        { path: '/second', component: SecondComponent }
    ])

谢谢.

推荐答案

这在新的RC.3路由器中不再起作用.异步路由的新方法似乎正在兴起

类似

@Routes([
    { path: '/first', component: 'app.first.component.js' },
    { path: '/second', component: 'app.second.component.js' }
])

另请参见 https://github.com/angular/angular/issues/8861 https://github.com/angular/angular/pull/8455/files(搜索@Routes

这篇关于Angular2.0.0-rc1异步路由器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆