I have this (excerpt of a) template:
<custom-panel [summary]="summary.activity" routerLink="/activities">
<a *ngIf="(user$ | async)?.verification.isOK" (click)="openQuestionModal()">Verify</a>
</custom-panel>
...and this "component" class:
// imports here
@Component({
selector: 'custom-panel',
templateUrl: './custom-panel.component.html',
styleUrls: ['./custom-panel.component.scss']
})
export class CustomPanelComponent implements OnInit {
public summary$: Observable<Summary>;
public user$: Observable<User>;
constructor(private service: UserService, private dialog: MdDialog) {
// ...
}
public ngOnInit() {
// Populate this.user$
// Populate this.summary$
}
public openQuestionModal(): void {
console.log('openQuestionModal() ...');
}
}
The issue is: whenever I click on the link to open up the "Questions Modal" it also takes me to the /activities route (and eventually the modal dialog is opened there).
Is there any way to prevent this?
The only way I've found so far is to have a boolean "flag" and updating the [routeLink] directive to: [routerLink]="isActive() ? '/activities' : null". I would like to get rid of that "flag".