大佬教程收集整理的这篇文章主要介绍了Angular 4路由器和模态对话框,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
但是如何使用超链接打开它?
<a [routerLink]="['/login']">Login</a>
另一个问题 – 是否有可能以编程方式执行此操作?这样我就可以
this.router.navigate(['/login']);
有什么建议?
import { ActivatedRoute,Params } from '@angular/router'; import { Component,OnInit } from '@angular/core'; @Component({ SELEctor: 'cmp1',templateUrl: './cmp1.component.html',styleUrls: ['./cmp1.component.css'],}) export class Cmp1 implements OnInit { constructor(private activatedRoute: ActivatedRoutE) { } ngOnInit() { this.activatedRoute.params.subscribe(params => { if (params["modal"] == 'true') { // Launch Modal here } }); } }
我相信你会有一个看起来像这样的链接:
< a [routerLink] =“['/ yourroute',{modal:'true'}]”>
可以在这里找到更好的例子:Route Blog
以上是大佬教程为你收集整理的Angular 4路由器和模态对话框全部内容,希望文章能够帮你解决Angular 4路由器和模态对话框所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。