1
我打开应用程序中的组件模式,而不是模板然后我需要将对象模型传递给模态组件,问题是打字稿给出错误的modalRef.componentInstance不存在作为属性,我完全复制示例形式演示页,但再次给予同样的错误,永远不会填充模态内容类的@input变量,angular 2 ng-bootstrap modal
这是错误 无法设置的不确定
@Component({
selector: 'company-list',
templateUrl: './app/components/company/company-list.component.html'
})
export class CompanyListComponent implements {
private modalRes: Company;
constructor(private modalService: NgbModal) {
}
open(company: Company) {
const modalRef = this.modalService.open(CompanyAddComponent);
modalRef.componentInstance.name = 'some name'; //** this line gives error
modalRef.result.then((result) => {
}, (reason) => {
});
}
createCompany(model: Company) {
this.companyService.createCompany(model);
}
}
和内部产权“模式”模态我宣布这个varable得到传入的值 @Input()型号:公司; 但它始终为空
谢谢你升级到1.0.0-alpha.9并再次安装节点包解决了问题 –