【问题标题】:Getting error white using ngx-bootstrap-modal in production mode angular 2在生产模式 angular 2 中使用 ngx-bootstrap-modal 获取错误白色
【发布时间】: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


【解决方案1】:

您使用的是哪个 Angular 版本?删除现有的节点模块并安装新的。可能对你有帮助

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-03-06
    • 1970-01-01
    • 2019-02-19
    • 1970-01-01
    • 2019-03-21
    • 2020-10-31
    • 2021-04-23
    • 1970-01-01
    相关资源
    最近更新 更多