I have a search.component.ts, where I am fetching data according to search criteria. Now I want to generate a report which is a basic html page and not search.component.html, based on the data I have in my search component. I want the html page to be opened on a different tab. Is there any suitable solution?
Asked
Active
Viewed 523 times
1 Answers
0
Create a button in your template:
<button type="button" (click)="redirect">Redirect</button>
Create a function in your component:
redirect(){
window.open(
'https://support.wwf.org.uk/earth_hour/index.php?type=individual',
'_blank' // <- This is what makes it open in a new window.
);
}
Ps. A simple google search found the window.open() function that accepts a second param to open a new window. see link JavaScript: location.href to open in new window/tab?