[英]How can I bind my route to a stepper in angular-material2?
您需要从'@angular/common'
注入并使用位置服务:
1)更改位置服务的URL调用go功能。 例:
if (this.stepper.selected.label === 'subscriber') {
this.location.go('./enrollment/subscriberInfo');
}
2)在URL更改后更改步进器,调用位置服务的用户功能。 例:
this.location.subscribe( () => {
if (this.location.isCurrentPathEqualTo('/enrollment/subscriberInfo')) {
this.stepper.selectedIndex = 0;
}
if (this.location.isCurrentPathEqualTo('/enrollment/payment')) {
this.stepper.selectedIndex = 1;
}
if (this.location.isCurrentPathEqualTo('/enrollment/agreement')) {
this.stepper.selectedIndex = 2;
}
});`
仅供参考,我使用了@Output() animationDone: EventEmitter<void>
来更改URL。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.