单击以角度2删除/取消激活辅助路径

时间:2016-03-25 12:49:05

标签: angular angular2-routing angular2-template

当我点击撰写按钮打开电子邮件模板时(例如,在点击撰写邮件时在gmail中给出),在单页中使用辅助路由获取多个模板。

问题是:当点击十字按钮时,如何删除或取消激活此辅助路线。

please see image for better explanation

app.ts

public class ContactModel
{
  [Required(ErrorMessage="Please enter the subject.")]
  [Display(Name="Subject")]
  public string Subject { get; set; }
}

app.html

   @RouteConfig([
    {
     path: '/',
     name: 'OpportunityList',
     component: OpportunityComponent,
     useAsDefault: true
    },
    {
     path: '/detail',
     name: 'Detail',
     component: DetailComponent
    },
    {
     aux: '/mailer', 
     name: 'Mailer', 
     component: MailerComponent
     }
   ])

mailer.component.ts

    <a [routerLink]="['/', ['Mailer'] ]" >Compose</a>

mailer.component.html

   export class MailComponent implements OnInit{
      closeEmail(){
          console.log("please suggest me to Deactivate this template")
       }
    }

1 个答案:

答案 0 :(得分:1)

this.router.navigate([{ outlets: { aux: null } }]);