【发布时间】:2017-08-29 15:04:33
【问题描述】:
我想在路由到 Profile 之前立即从远程服务中获取所有数据。
我发现 typescript 版本的 angular 有 Resolve 来帮助在导航之前获取数据。但我在 Dart 版本中找不到任何示例(angular2: ^3.0.0)。
@RouteConfig(const [
const Route(path: '/', name: 'Home', component: HomeComponent, useAsDefault: true]),
const Route(path: '/profile', name: 'Profile', component: ProfileComponent),])
class AppComponent implements OnInit{
}
有人知道如何使用 Dart 来处理它吗?
【问题讨论】:
-
Angular.dart 中的当前路由器没有
Resolve。根据您尝试完成的具体任务,可能会有不同的解决方法。还有人提到,Angular.dart 的新路由器正在开发中(尽管可能还需要一段时间) -
感谢您的回复。我想在渲染 ProfileComponent 之前获取所有必需的数据,因为当浏览器渲染所有静态内容并且 ProfileComponent 中的某些子组件仍在等待异步 Http 结果时,我试图防止饱和。我希望我的 UI 显示为一个整体,就像服务器端渲染一样。
标签: dart angular-dart