-
Notifications
You must be signed in to change notification settings - Fork 136
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
No value accessor for 'username' #100
Comments
Sorry for the delay in getting back to you. I'm going to take a look this evening. |
This does the trick for me: x220:~/code/golfbot_app$ git diff app/pages/login/login.html
diff --git a/app/pages/login/login.html b/app/pages/login/login.html
index 8fd02f0..871265a 100644
--- a/app/pages/login/login.html
+++ b/app/pages/login/login.html
@@ -9,10 +9,10 @@
</ion-card-header>
<ion-list>
<ion-item>
- <ion-input type="text" ngControl="username" value="" placeholder="Username/Email"></ion-input>
+ <ion-input type="text" value="" (ngControl)="username" placeholder="Username/Email"></ion-input>
</ion-item>
<ion-item>
- <ion-input type="password" ngControl="password" placeholder="Password"></ion-input>
+ <ion-input type="password" (ngControl)="password" placeholder="Password"></ion-input>
</ion-item>
</ion-list>
</ion-card Reference: http://stackoverflow.com/a/36471115/5083721 (Please reopen if this doesn't solve for you) |
The above doesn't solve it for me, though I'm not the original poster. I recently posted the problem here https://forum.ionicframework.com/t/beta-10-karma-testing-fails-when-using-ngmodel-in-template-with-error-no-value-accessor-for/56357 |
Thanks a lot for the info. I'm tracking this on #108 as it's since been raised again and OP didn't get back to me. |
When I run
ionic serve
, my code seems to work fine, but when I run my tests withnpm test
(following your AMAZING tutorial), the tests fail and I get an error:Error: No value accessor for 'username'
I've tracked the problem down to the markup used for the
<input>
elements. If I use the<ion-input>
(to get the pretty formatting) then the error is thrown. If I just use a plain<input>
then there is no error and the tests all pass. I'm thinking there might be something the matter with the way that either browserify or PhantomJS handles the non-standard elements??? Here's my code if you'd like to look.The problem is with my login form. Here is the relevant HTML:
And here is the code:
AMAZING tutorial! I spent many days trying to get TDD working with my Ionic2/Angular2 app dev workflow with no luck. Thank you!!!
The text was updated successfully, but these errors were encountered: