-
Notifications
You must be signed in to change notification settings - Fork 13.5k
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
Ionic 2, beta 11, ngModel for 2 way data binding syntax #7838
Comments
Hello, thanks for opening an issue with us! Unfortunately, I am unable to reproduce this issue at this time. Would you be able to make a repo with a minimal example of this issue? Thanks! |
Hi, Update packagesSee Steps to Upgrade to Beta 11.
See that now your app depends on Application bootstrapInside
Import new stuffAt the beginning of the component file import new stuff (only what you need),
and inject dependencies:
Modify templateModify the template with new control names:
Hope this could help you or addressing you the right way to deal with your issue. Pay attention to install Angular2 RC4 because RC5 introduces |
Wow. That's a good effort, well done. I'm actually using ngModel independently of any forms but it's good to have this as an option that works. |
I'm using
For more info: #angular/angular#9230 (comment) |
I just came across a similar issue on upgrading to beta11. If you check out the ionic conference app on github and look at the login page it is using ngmodel for the login form and has incorporated some syntax changes. I just updated my form to remove a couple of old values and follow that example and everything was good again. |
Hi - thanks to everyone for the feedback. I am using ngModel outside a form, i.e. there is no form on the page, just for simple 2 way data binding as indicated in the angular docs. https://angular.io/docs/ts/latest/guide/template-syntax.html#!#binding-syntax The example from the conference app is using ngModel inside a form so unfortunately is not my use case. The option of:
looked promising, and I suspect might work. I think what has happened in beta11 is that ngModel has been moved from the core into a forms module that I am not currently importing since it was not required before beta11 and I am not using forms in my app. Any ideas about the current syntax for importing the forms module into ionic 2? |
Try this (not tested)
OR
I only imported |
Hello @tomgallagher ! Could you check that you are in fact running Angular 2 rc4 and not Angular 2 rc5? To check this you can go into your node_modules and check the package.json of the |
Here's my package.json from the core module
Just to check, I had a look at the same for my forms:
Not sure if that's right. So I ran
Then:
But the package.json remains the same. Strange. |
@tomgallagher ahh, forms should be 0.2.0 and not 0.3.0. To install with |
Yes that's been the ongoing problem. Sorry to waste your time with this. I had forms 0.2.0 installed but in the wrong directory. Please close this issue to save me any more embarrassment! |
hahaha dont worry i make the same kind of mistakes all the time. Im glad we figured out what the issue was. Also, thanks everyone for all the help, so nice to see the community coming out to help with an issue! |
I've been using code like this all over my app:
<ion-input [(ngModel)]="home_URL" id="homeURL" type="text"></ion-input>
Yet after updating to beta11, all of the pages using ngModel are now causing errors.
I have narrowed it down to ngModel but cannot work out why it has suddenly stopped working and how to fix it.
The text was updated successfully, but these errors were encountered: