shlomiassaf / ngx-modialog

Modal / Dialog for Angular
http://shlomiassaf.github.io/ngx-modialog
MIT License
686 stars 242 forks source link

Displaying non-static content without subclassing ModalComponent? #172

Closed colinmorris closed 8 years ago

colinmorris commented 8 years ago

All the examples in the demo/quickthrough show modals with static HTML content. The exception is the custom modal example, which subclasses ModalComponent.

I'm wondering if there's any middle-ground if I want to use some directives in the modal content, but have no need to change the behavior of the modal (as the AdditionCalculateWindow example does).

Basically, I want to be able to do something like...

<modal size="lg" showClose="true" #modal>
    <my-custom-component>
    <my-other-custom-component>
    <p>etc.</p>
</modal>
<button (click)="modal.open()">My modal</button>

It seems like it's not as simple as just putting template stuff inside the strings passed to body() or title() when using one of the preset builders. The source mentions that "When using HTML, the template is not compiled. (binding and expression will not parse)"

But is there another way to do this? (If so, it would be great to have an example of this in the docs).

shlomiassaf commented 8 years ago

I'm working on a new feature for using templates and simple strings... next release will have it

shlomiassaf commented 8 years ago

this is also a bit tricky, since the context (configuration) is different from plugin to plugin.

For example, the bootstrap plugin has a dialogClass property that default to some value, if its not present the modal will not display the way it should.

It is set by default when using the bootstrap Modal service however, this is different, no service here just s component which isn't plugin specific.

shlomiassaf commented 8 years ago

Feature was implemented

sime commented 8 years ago

Just to confirm the feature is in v2 of the plugin, and it is called SwapComponent?