I know there is a $window service
in Angular 1.x. Now, I want to open an URL in a new tab, I haven't found any service to do this.
UPDATE:
Seems Angular 2 itself doesn't provide a method/service like Angular 1.x. If you want to navigate inside of an Angular app, you can refer to Angular Router - navigate(). I'm asking this question because I want to navigate using some method provided by Angular, but none of the answers is what I expect.
It sounds like the OP wanted to know how to use $window in angular2 to open a link in either a new tab or window - not to distinguish between them. In case this helps anyone, first declare window:
interface MyWindow extends Window {
myFunction(): void;
}
declare var window: MyWindow;
then open the link as usual
window.open(url);
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