angularionic-frameworkangular-ui-routerionic4

How to implement ion-chip clickable, when click page navigate to another page?


I am ionic 4 framework, in that i used ion-chip, i want to this ion-chip clickable. for example when i click on ion-chip navigate to another page.Here is the ion-chip documentation


Solution

  • You can add routerLink any element to navigate to another page.

    <ion-chip routerLink="/home">
      <ion-label>Home</ion-label>
    </ion-chip>
    
    <ion-chip>
      <ion-label routerLink="/details/42" color="secondary"> Details </ion-label>
    </ion-chip>
    

    Or you in component (html) :

    <ion-chip (ionClick)="openPage()">
       <ion-label>Home</ion-label>
    </ion-chip>
    

    component :

    openPage(){
       this.router.navigateByUrl('/home');
    }