在使用Ng-Bootstrap模态框编辑器时,遇到无法加载任何数据的问题,可能是由于以下原因:
1.数据没有被正确传递
2.模态框没有正确初始化
3.模态框没有正确绑定数据
解决此问题的方法,可以参考以下示例代码:
HTML模板:
TypeScript代码:
import { Component, OnInit } from '@angular/core'; import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
@Component({ selector: 'app-test', templateUrl: './test.component.html', styleUrls: ['./test.component.scss'] }) export class TestComponent implements OnInit {
data: any = {
title: '',
description: ''
};
constructor(private modalService: NgbModal) { }