【发布时间】:2017-12-26 07:09:07
【问题描述】:
无法解析 'l'(?) 的所有参数。确保所有参数都用 Inject 修饰或具有有效的类型注释,并且 'l' 用 Injectable 修饰。 下面是我的代码
import { Component, OnInit } from '@angular/core';
import { ItemModalComponent } from './item-modal/item-modal.component';
import { BsModalRef } from 'ngx-bootstrap/modal/modal-options.class';
import { BsModalService } from 'ngx-bootstrap/modal/bs-modal.service';
@Component({
selector: 'app-items',
templateUrl: 'items.component.html',
styleUrls: ['./items.component.scss']
})
export class ItemsComponent implements OnInit {
bsModalRef: BsModalRef;
constructor(private modalService: BsModalService) {}
openItemModal() {
this.bsModalRef = this.modalService.show(ItemModalComponent, {class:
'modal-lg'});
console.log(this.bsModalRef);
this.bsModalRef.content.title = 'New Item';
}
ngOnInit() { }
}
【问题讨论】:
-
在进行 aot build 时是否出现错误?
-
不,它构建成功,加上它在开发模式下工作
-
尝试使用 BsModalService 的 @Inject 装饰器仍然无法正常工作
标签: angular