Ion-item-divider href

#1

Anyone knows how to add a router href on ion-item-divider?

I use ion-item-divider in my ion-menu to group my ion-item, which have href, and I would like to add an action/navigation to these dividers too, but don’t know how as there isn’t such an attribute according the doc https://ionicframework.com/docs/api/item-divider

P.S.: I’m using Ionic core not angular

#2

Could you wrap it in a div then apply the router href to it? Curious on the solution.

#3

thx for the feedback, actually I’m not sure to understand what you mean…if you’ve got 2min could you just display a dummy html code mockup of that?

#4

Maybe something like this?

<ion-list>
<div href="/details/A">
  <ion-item-divider>
    <ion-label>
      Section A
    </ion-label>
  </ion-item-divider>
</div>
  <ion-item><ion-label>A1</ion-label></ion-item>
  <ion-item><ion-label>A2</ion-label></ion-item>
  <ion-item><ion-label>A3</ion-label></ion-item>
  <ion-item><ion-label>A4</ion-label></ion-item>
  <ion-item><ion-label>A5</ion-label></ion-item>
#5

Oh thx, then I understood correctly :wink:

That isn’t accepted by the compilator (Stencil) as href isn’t a known property of div

[ ERROR ]  TypeScript: src/app/app-root.tsx:92:21
           Type '{ href: string; }' is not assignable to type 'HTMLAttributes<HTMLDivElement>'. Property 'href' does
           not exist on type 'HTMLAttributes<HTMLDivElement>'.