ngx-modialog icon indicating copy to clipboard operation
ngx-modialog copied to clipboard

BSModalContext not found in ngx-modialog/plugins/bootstrap

Open upendrasengarmbwk opened this issue 6 years ago • 1 comments

I'm submitting a ... [x] bug report [ ] feature request [ ] question about the decisions made in the repository

  • What is the current behavior?

I'm using latest version but unable to create a custom component as modal dialg altough it was working with older version angular2-modal.

import { Modal, BSModalContext } from 'ngx-modialog/plugins/bootstrap';

ERROR in src/app/app.module.ts(33,38): error TS2307: Cannot find module 'ngx-modialog/plugins/bootstrap'. src/app/components/requests/popups/approved-request/approved-request.component.ts(4,39): error TS2307: Cannot find module 'ngx-modialog/plugins/bootstrap'.

Code Sample

  import { Component, OnInit } from '@angular/core';
  import { Overlay, DialogRef, ModalComponent, CloseGuard } from 'ngx-modialog';
  import { Modal, BSModalContext } from 'ngx-modialog/plugins/bootstrap';`
  export class CustomModalContext extends BSModalContext {
        public modalData: any;
  }
  @Component({
           selector: 'modal-content',
            templateUrl: './approved-request.component.html'
   })

  export class ApprovedRequestModal implements OnInit, CloseGuard, 
    ModalComponent<CustomModalContext> {
    context: CustomModalContext;
    public modalData: any;
    public img;

   constructor(
      public dialog: DialogRef<CustomModalContext>,
    ) {
      console.log(dialog.context);
      this.context = dialog.context;
      dialog.setCloseGuard(this);
  }
  ngOnInit() {
  }

  beforeDismiss(): boolean {
      return false;
  }

  beforeClose(): boolean {
      return false;
  }

  close() {
  }
}

upendrasengarmbwk avatar Apr 10 '18 11:04 upendrasengarmbwk

Try this solution...

https://github.com/shlomiassaf/ngx-modialog/issues/398

That's a problem with Typescript 2.5.3. If you go back to 2.5.2, it should work. I had the same issue.

zerocewl avatar May 31 '18 15:05 zerocewl