Angular 省道角度路线参数不起作用

Angular 省道角度路线参数不起作用,angular,dart,angular-dart,Angular,Dart,Angular Dart,我正试图让AngularDart路由正常工作,这让我头疼。我正在尝试获取子路由的查询参数,但在像这样扩展OnActivate时,它在我的组件中不起作用。它可以识别页面,但没有在RouterState中给我参数。我不知道为什么。我没有收到任何错误,也没有收到任何警告或任何东西。我现在可以使用Uri类绕过它来测试其他东西并保持动力,但我更愿意让它按预期工作 结构如下: Top - /routes.dart - /route_paths.dart - /resources_list_compon

我正试图让AngularDart路由正常工作,这让我头疼。我正在尝试获取子路由的查询参数,但在像这样扩展OnActivate时,它在我的组件中不起作用。它可以识别页面,但没有在RouterState中给我参数。我不知道为什么。我没有收到任何错误,也没有收到任何警告或任何东西。我现在可以使用
Uri
类绕过它来测试其他东西并保持动力,但我更愿意让它按预期工作

结构如下:

Top
 - /routes.dart
 - /route_paths.dart
 - /resources_list_component.dart
 - /resources
   - ./resources_routes.dart
   - ./resources_route_paths.dart
   - ./my_resource_component.dart
   - ./my_resource_component.html
/route\u路径中。dart
我有

static final resources = RoutePath(path: 'resources');
然后用于
/routes.dart

static final resources = RouteDefinition(
  routePath: RoutePaths.resouces
  component: resource_list_template.ResourceListComponentNgFactory
);
    static final resource = RouteDefinition(
        routePath: ResourcesRoutePaths.resource,
        component: my_resource_template.MyResourceComponentNgFactory,
    );

    static final all = <RouterDefinition>[ resource ];
然后,我将此路由用作资源路由路径文件中的父路由器:

static final resource = RoutePath(
  path: 'resource/:id',
  parent: _parent.RoutePaths.resources
);
在上面的代码片段中,您可以看到我希望RouterState具有AngularDart文档中建议的查询参数
id
。这样我就可以做这样的事情:
http://localhost/#/resources/resource/1

然后在
资源/resources\u路由中使用此路由器路径。dart

static final resources = RouteDefinition(
  routePath: RoutePaths.resouces
  component: resource_list_template.ResourceListComponentNgFactory
);
    static final resource = RouteDefinition(
        routePath: ResourcesRoutePaths.resource,
        component: my_resource_template.MyResourceComponentNgFactory,
    );

    static final all = <RouterDefinition>[ resource ];

上述代码输出
true
。在查询中,参数为空。我遵循了指南,在这一点上我不知道我错过了什么。有人知道为什么会发生这种情况吗,或者如果我遗漏了一个明显的步骤???

问题是您试图访问
查询参数
,而不是
参数

Console().log(current.queryParameters.isEmpty)

vs

Console().log(current.parameters.isEmpty)

parameters
map返回URL参数,而
queryParameters
map返回查询参数。例如,给定url:

/resources/resource/1?嘿=dude

“1”是url参数,“hey”是查询参数