Angular2: open a popup and load a component into it

I have an angular2 application and I want to open another window and load the component into it. I am currently using my own JS window.open () method and pass the result of the required routing to it:

import { Component } from 'angular2/core';
import { Router } from 'angular2/router';

@Component({
  selector: 'uploader',
  template: `
    <div>
      <button type="button" (click)="startUpload()">
        Upload File
      </button>
    </div>
    `,
  styleUrls: []
})

export class UploaderComponent {
  constructor(private _router: Router) {}

  startUpload(mediaFile: File) {
    let windowObjectReference;

    windowObjectReference = window.open(
      // first param is location
      <string>this._router.navigate(['Feature']),
      'DescriptiveWindowName',
      'width=420,height=230,resizable,scrollbars=yes,status=0,toolbar=0,menubar=0,location=0'
    );

  }
}

As a result, a new window opens correctly, but does not direct to the intended component. The original window (and not a new popup) is directed to the route Feature. Error in new window:

Cannot GET /src/[object%20Object]

Any idea what I'm doing wrong? Thank!

+4
source share

All Articles