Open a new window tab on click of a button to display details in angular application
I was able to open a new tab with window.open functionality but in order to get the details a web service call is required i have a component already taking care of that i want to invoke the component on click
userHome.html
<div id="buttonId">
<button mat-raised-button (click)="detailsWindow()"
[ngClass]="UserDetailClass()" >User Detail</button>
UserHomeComponent
(click)="detailsWindow(event) {
//routing logic to get to the component i need to invoke UserDetailComponent
window.open(url, '_blank', 'location=yes,height=570,width=520,scrollbars=yes,status=yes');
}
UserDetailComponent
I will be passing id and Flag as params
ngOnInit() {
this.userDetailOnLoad= true;
this.userId = this.data;
this.statusFlag = this.data.statusFlag;
this.userDetailService.getUserDetails( this.userId,this.statusFlag).subscribe(
data => {
this.userDetails = data;
}
);
}