单击以删除/停用角度2中的辅助路线 [英] click to remove/Deactivate Auxiliary Route in angular 2
本文介绍了单击以删除/停用角度2中的辅助路线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我确实单击撰写"按钮以打开电子邮件模板时(例如,在单击以撰写邮件时在gmail中给出),在单个页面中使用多个模板的辅助路由".
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屋!
查看全文