click to remove/Deactivate Auxiliary Route in angu

2019-07-16 05:59发布

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.

please see image for better explanation

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>

1条回答
Ridiculous、
2楼-- · 2019-07-16 06:01
this.router.navigate([{ outlets: { aux: null } }]);
查看更多
登录 后发表回答