shlomiassaf / ngx-modialog

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

Use multiple input fields in dialog #390

Closed lexon0011 closed 7 years ago

lexon0011 commented 7 years ago

I use angular2-modal@3.0.2. Is there a way to use multiple input fields in a dialog? I need it for some user inputs. Like this:

.body(`
   <h1>Test</h1>
   <input type="text" name="test1" [(ngModel)]="testInput" />
   <input type="text" name="test2" [(ngModel)]="testInput" />
`)

I found only a way to use one input field.

Thanks!

shlomiassaf commented 7 years ago

Yes, you need to use a custom component.

The library provides a small set of common scenarios like alert, prompt and confirm and that's it, anything else should be done via a custom component.

You want multiple input, then someone else wants 3 inputs 1 checkbox and 2 radio buttons... its endless...

lexon0011 commented 7 years ago

I try the custom component with the angular2-modal@3.0.2. I use for trying this demo. I insert the component in the html template (<modal-content></modal-content>) and register the component in the module declaration.

But now I get the following error: Error: No provider for DialogRef!

My SystemJS configuration for angular2-modal:

"paths": {
    'angular2-modal': 'node_modules/angular2-modal/bundle/angular2-modal.rollup.umd.js',
    'angular2-modal/plugins/bootstrap': 'node_modules/angular2-modal/plugins/bootstrap/bundle/angular2-modal-bootstrap.rollup.umd.js',
}

Is there something else to do or is there a mistake?

Thanks!

shlomiassaf commented 7 years ago

See this demo, v 3.0.3

http://plnkr.co/edit/2ppVYl517GI1Byv8vVbG?p=preview

lexon0011 commented 7 years ago

I extend your demo with a custom dialog. Now I get the following error:

Unhandled Promise rejection: No provider for t!

I thing it is the same error, but because of uglifying the output is "t" instead of "DialogRef"

You find the updated sample here: http://plnkr.co/edit/IIs2E1jgV0nILeLzkMAV

lexon0011 commented 7 years ago

Could you reproduce the error?

lexon0011 commented 7 years ago

Is there already a solution? Is it reproducable? I would be very grateful for your help!