单击以删除/停用角度 2 中的辅助路线 [英] click to remove/Deactivate Auxiliary Route in angular 2
本文介绍了单击以删除/停用角度 2 中的辅助路线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我点击撰写按钮打开电子邮件模板时(例如,当点击撰写邮件时在 gmail 中给出),在单页中使用多个模板的辅助路由.
问题是:当点击十字按钮时,如何移除或停用此辅助路径.
app.ts
@RouteConfig([{小路: '/',name: '机会列表',组件:机会组件,useAsDefault: 真},{路径:'/详细信息',name: '细节',组件:细节组件},{辅助:'/邮件',name: '邮递员',组件:MailerComponent}])
app.html
mailer.component.ts
导出类 MailComponent 实现 OnInit{关闭电子邮件(){console.log("请建议我停用此模板")}}
mailer.component.html
<h3 class="title">新消息<a (click)="closeEmail()" class="close"><i class="fa fa-times"></i><;/a></h3>
解决方案
this.router.navigate([{ outlet: { aux: null } }]);
When I do click on compose button to open email template (e.g; as given in gmail when click to compose mail), using Auxiliary Route for multiple template in single page.
Question is : how to remove or Deactivate this Auxiliary Route, when click on cross button.
app.ts
@RouteConfig([
{
path: '/',
name: 'OpportunityList',
component: OpportunityComponent,
useAsDefault: true
},
{
path: '/detail',
name: 'Detail',
component: DetailComponent
},
{
aux: '/mailer',
name: 'Mailer',
component: MailerComponent
}
])
app.html
<a [routerLink]="['/', ['Mailer'] ]" >Compose</a>
mailer.component.ts
export class MailComponent implements OnInit{
closeEmail(){
console.log("please suggest me to Deactivate this template")
}
}
mailer.component.html
<div class="header with-bord">
<h3 class="title">New Message <a (click)="closeEmail()" class="close"><i class="fa fa-times"></i></a></h3>
</div>
解决方案
this.router.navigate([{ outlets: { aux: null } }]);
这篇关于单击以删除/停用角度 2 中的辅助路线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文