I have a button and on click of that button a new window should be opened with a new provided URL. For example:
<button class="btn btn-help"(click)="helpWindow($event)" type="submit"></button>
How do I handle this even at backend in the typescript file? I will get the URL from REST API and I want to open a new window with that link
Events are handled in Angular using the following special syntax. Bind the target event name within parentheses on the left of an equal sign, and event handler method or statement on the right. Above, (click) binds the button click event and onShow() statement calls the onShow() method of a component.
helpWindow(event) {
window.open(document.URL, '_blank', 'location=yes,height=570,width=520,scrollbars=yes,status=yes');
}
See also https://stackoverflow.com/a/14132265/217408
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With