如何使用angular4和加载组件内容打开模态窗口?

时间:2018-02-06 20:59:46

标签: javascript angularjs twitter-bootstrap ng-bootstrap

我已经导入ngbModal模块从ng2bootstrap现在我正在尝试打开模态窗口并将当前组件内容加载到模态体中。实施的正确方法是什么?

search.components.ts

import { Component, OnInit,Pipe, PipeTransform, EventEmitter,Input, Output,OnChanges, SimpleChanges } from '@angular/core';
import {GtConfig} from '@angular-generic-table/core';
import {NgbModal} from '@ng-bootstrap/ng-bootstrap';
import * as io from 'socket.io-client';


    @Component({
      selector: 'app-detail',
      templateUrl: './detail.component.html',
      styleUrls: ['./detail.component.css'],

    })
export class DetailComponent implements OnChanges{
    constructor(private detailService: DetailService,private ngbModal: NgbModal) {};
    ngOnInit(){
     this.secondConfigObject = {
         settings: this.getBaseSettings(),
         fields: this.getBaseFields(),
         data: []
         };
    })
    }

     rowData(event) {
      console.log('Event',event);
      this.detailService.changeChart(event);
    }
   execModal(evt){
     const modalReg  = this.ngbModal.open(Component);
   }
}

0 个答案:

没有答案