Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ModalOptions.show property value is ignored #1680

Closed
DethAriel opened this issue Feb 23, 2017 · 3 comments
Closed

ModalOptions.show property value is ignored #1680

DethAriel opened this issue Feb 23, 2017 · 3 comments

Comments

@DethAriel
Copy link
Contributor

Based on documentation here, if [options]="{ show: true }" is provided, then the modal should be shown upon initalization.
But this value is not even checked anywhere in modal.component.ts.

So, the option does not work. But it is a really nice one, since it allows to handle modals with *ngIf statements instead of show() / hide()

@DethAriel
Copy link
Contributor Author

Also, based on https://github.com/valor-software/ng2-bootstrap/blob/development/src/modal/modal-options.class.ts#L26 this option has not really been working ever

@DethAriel
Copy link
Contributor Author

If anyone else is interested, it can be work-arounded like this:

// place this somewhere, e.g. vendor.ts
import { ModalDirective, modalConfigDefaults } from 'ng2-bootstrap';

const nativeFn = ModalDirective.prototype.ngAfterViewInit;

modalConfigDefaults.show = false;
ModalDirective.prototype.ngAfterViewInit = function(this: ModalDirective) {
  nativeFn.apply(this, arguments);
  if (this.config.show) {
    this.show();
  }
}

@valorkin
Copy link
Member

valorkin commented Mar 1, 2017

@DethAriel if you will make it as a PR
I will be very grateful ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants