dart - 如何在Dart中设置@RouteConfig

标签 dart angular angular2-routing

鉴于以下

.ts

@RouteConfig([
  { path: '/',          name: 'root',      redirectTo: ['Home'] },
  { path: '/home',      name: 'Home',      component: HomeComponent },
  { path: '/about',     name: 'About',     component: AboutComponent },
  { path: '/contact',   name: 'Contact',   component: ContactComponent },
  { path: '/protected', name: 'Protected', component: ProtectedComponent },
])

在dart中使用相同的代码会产生很多错误。什么是正确的 Dart 代码?为列表添加const不能更正错误

最佳答案

在Dart中,您需要引用 map 键

{ 'path': '/', 'name': 'root', 'redirectTo': ['Home'] }

关于dart - 如何在Dart中设置@RouteConfig,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35782824/

相关文章:

Flutter - 该方法在 null 上调用

angular - Angular2 中的无限嵌套路由

angular - "this"不能用于 typescript 函数 (Angular)

angular - 在 Angular 2 中用 subview 替换父 View 路由器 View

flutter - 在GridView中使图像和文本居中对齐

flutter - Flutter/dart访问另一个列表中的listData

firebase - Flutter:Firebase 如何更改查询和内容

Angular 应用程序更新到版本 8 后无法在 Firefox 上运行

javascript - 我可以同时热模块重新加载服务器(.NET Core)和客户端(Angular)吗?

angular - 如何让component.ts在加载模板之前加载所有响应?