'Use *ngIf= for specific router link and all child routes
Problem: Show [content] in all child routes of parent route ie. <div *ngIf="router.url === '/parent/child'">[content]</div> to make it so that ./parent/child1, ./parent/child2, ./parent/child(n), all show [content]
Proposed solution: <div *ngIf="router.url === '/parent/**'">[content]</div>, or variations <div *ngIf="router.url === '/parent/..'">[content]</div>, does not seem to be accepted by the angular framework.
Documentation: https://angular.io/guide/router#setting-up-wildcard-routes
Based on
Solution 1:[1]
Bumping Fiehra's answer as a proposed solution: use *ngIf="router.url.includes('/parent/) to demarcate child routes referring to the parent. Resolved my problem.
Edit: You can also set up a customized service to make sure that you are on the appropriate type of page.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
