-1

I have a 'form' that the user selects an option and the app takes them to the next page where they need to select again an option. Each list of options is a different component. I also have a header component which is static and is displayed on all pages. I would like to hide the Previous button on the first page, how can I do that?

I can use ngIf directive for conditional rendering but how can I know on which page I am now? And how do I translate that into Angular + Typescript code?

Thank you

Harvey
  • 93
  • 1
  • 7
  • there has been a post on how to get current route in Angular https://stackoverflow.com/q/34597835/19433398 – Nathan T. Feb 06 '23 at 13:30

1 Answers1

0

You create a container component that renders the other components. Then for the component that you want to hide previous button on, you can pass in an @Input() variable hidePrevious. Your container component will know if this component should hide previous or not.

O.MeeKoh
  • 1,976
  • 3
  • 24
  • 53