带有Angular 2的DialogAPI:使用displayDialogAsync在对话框中对我的角度2组件进行Diasplay

Har*_*hah 5 javascript office-js angular2-routing angular

我是Angular 2和office js的新手.我读了一下displayDialogAsync并创建了一个样本.

我的工作样本现在显示html页面,但我想在office js对话框中显示角度2组件,然后尝试将其重定向到不同的域.

HTML页面:Waiting.html(仅等待2秒)

app.Component.html :::

<div>

<router-outlet></router-outlet>
    <br /> Testing...
    <div class="ms-Grid">
        <div class="ms-Grid-row">
            <div class="ms-Grid-col">
                <input type="button" value="OpenDialog" (click)="openDialog()" />
            </div>
        </div>
    </div>
</div>
Run Code Online (Sandbox Code Playgroud)

组件:AppComponent

import { Component, OnInit, Input } from '@angular/core';
import { WordService } from './office/word.service';
import { Router, ActivatedRoute, ActivatedRouteSnapshot, NavigationEnd, RouterStateSnapshot, Event, UrlSerializer } from '@angular/router';
import { Location } from '@angular/common'

@Component({
    moduleId: module.id,
    selector: 'addin',
    templateUrl: 'app.component.html',
    providers: [WordService]
})

export class AppComponent implements OnInit {
    title: string = 'Angular 2 Excel Add-in';
    private newURL: string;
    constructor(private wordService: WordService, private _router: Router, private _activatedroute: ActivatedRoute,
        private urlSerializer: UrlSerializer,
        private location: Location) {}
    ngOnInit() { }

    openDialog() {

        this.newURL = location.protocol + '//' + location.hostname + (location.port ? ':' + location.port : '') + "/Waiting.html";
        Office.context.ui.displayDialogAsync(this.newURL, { height: 50, width: 50 });
        //Office.context.ui.displayDialogAsync(this._router.navigate(['login/test']), { height: 20, width: 20 });        
    }
}
Run Code Online (Sandbox Code Playgroud)

预期结果 :

显示对话框中的任何组件,然后重定向到customdomin并从customdomain获取响应并将其传递给我们的办公室加载项.

请帮我.

提前致谢.