假设我在我的组件中订阅了route params: this.route.params.subscribe((params) => {
// what the params object holds
// params.id1 params.id2
// what the current route looks like
//localhost/params.id1/params.id2
}); 我如何在Angular中对params.id2进行单元测试?示例:我想测试params.id2是否>0 目前,我已经这样做了: // top of th
我对angular中的单元测试很陌生。我们使用的是jest,并不知道如何测试路由是否返回数据。我想知道我们是否可以做单元测试来检查数据是否从angular中的路由返回。任何帮助都非常感谢 在我的班级component.ts public data$: Observable<Data>;
public salariesPerHours: salariesPerHoursViewModel[];
private destroy$ = new Subject<boolean>();
constructor(private activatedRoute: Ac
我有一个组件PersonTabsComponent,它扩展了抽象组件PersonParentComponent(contains ( person模型),其中我使用了来自模型的一些信息。在这个组件中,我还定义了其他组件,用于扩展相同PersonParentComponent.的地址和其他信息。
我想要做的是,在更新person模型之后,重定向到相同的路由,然后使用解析器PersonResolver和activatedRoute.将所有components.The数据注入到所有组件中。
export abstract class PersonParentComponent {
person
在我的角5项目中,我尝试为我的组件创建面包屑,我遵循了这个指南
. other =‘other 3’>只显示app-component.html文件,并且它不会在其他组件中显示.我想要在某些部件上有珠屑。
比如:
export class BreadcrumbComponent implements OnInit {
breadcrumbs$;
// Build your breadcrumb starting with the root route of your current activated route
constructor(private activ
我试图在一个使用角材料2的组件上编写一个测试,但是当我将它添加到我的testModule声明中时,我得到:
Error: Template parse errors:
'md-card-title' is not a known element:
1. If 'md-card-title' is an Angular component, then verify that it is part of this module.
2. If 'md-card-title' is a Web Component then add