Questions tagged «angular2-modules»


7
如何作为模块的子级路由至模块-Angular 2 RC 5
我正在将正在开发的应用程序升级到最新的Angular 2候选版本。作为这项工作的一部分,我试图使用NgModule规范并将应用程序的所有部分迁移到模块。在大多数情况下,除路由问题外,一切进展顺利。 "@angular/common": "2.0.0-rc.5", "@angular/compiler": "2.0.0-rc.5", "@angular/core": "2.0.0-rc.5", "@angular/forms": "0.3.0", "@angular/http": "2.0.0-rc.5", "@angular/platform-browser": "2.0.0-rc.5", "@angular/platform-browser-dynamic": "2.0.0-rc.5", "@angular/router": "3.0.0-rc.1", 我的应用程序是由模块组成的,其中几个模块作为父模块的子级粘合在一起。例如,我有一个由通知模块,用户模块和电话模块(例如)组成的管理模块。这些模块的路由应如下所示: /admin/notifications/my-notifications /admin/users/new-user /admin/telephony/whatever 在较早的路由器版本中,使用“儿童”可以轻松完成此操作 export const AdminRoutes: RouterConfig = [ { path: "Admin", component: AdminComponent, Children: [ ...UserRoutes, ...TelephonyRoutes, ...NotificationRoutes ] } ] 在另一个文件中,作为子模块的一部分,我还要定义各个模块的路由,即 export const UserRoutes: RouterConfig = [ { …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.