ng2-bootstrapでモーダルを実装しようとしていますが、このエラーが発生しました'Error:ApplicationRef instance not found'とわかりませんどうすれば修正できますか?ng2-bootstrapでモーダルを実装しようとするとエラーが発生する
ng2-bootstrap、それはいくつかのハックを追加すると言いましたが、app.component.tsに設定しようとしましたが動作しません。
アドオンdomain.component.html
<!-- Large modal -->
<button class="btn btn-primary" (click)="lgModal.show()">Large modal</button>
<div bsModal #lgModal="bs-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" (click)="lgModal.hide()" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<h4 class="modal-title">Large modal</h4>
</div>
<div class="modal-body">
...
</div>
</div>
</div>
</div>
アドオンdomain.component.ts
import { Component, ViewContainerRef } from '@angular/core';
@Component({
selector: 'add-domain',
templateUrl: 'add-domain.component.html',
})
export class AddDomainComponent {
private viewContainerRef: ViewContainerRef;
public constructor(viewContainerRef: ViewContainerRef) {
// You need this small hack in order to catch application root view container ref
this.viewContainerRef = viewContainerRef;
this.title = "Ajouter un domaine"
}
}
「角度2.2.0」を使用していますか? –
バージョンは2.2.3 –
です:https://github.com/valor-software/ng2-bootstrap/issues/1235 –