-
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
@Input decorator breaks Ionic 2 App #5741
Comments
Not an expert with Angular 2 here but I think you need to add brackets after |
I tried it with Input() also and it still does not work. @input() name: string; |
Here this is another guy having the same issue https://forum.ionicframework.com/t/input-decorator-breaks-directive-component/45110 |
In your html is your input surrounded by brackets?
|
yes I had it like this [name]="username" and I was trying to set this.username in my js file as stated above |
this is the guide I was trying to follow |
My HTML File on how I am trying to use the directive is as follows:
|
My User component HTML is as follows:
|
From
You can do it in TypeScript however:
I'm actually not sure what the status of property decorators is with Babel or how one would make use of
It looks like you've already done this, so you shouldn't need to use We're going to be switching the tutorials and code examples on the docs to default to TypeScript: ionic-team/ionic-site#479, so hopefully that removes some of the friction and confusion for people who are seeing Angular 2 examples in TypeScript and then starting Ionic projects that don't use it. Going to close as not a bug, but please let us know if we can clarify anything or you're still having issues, thanks! |
Thank You |
Short description of the problem:
When I add @input decorator the app breaks saying:
Module build failed: SyntaxError: ~/app/pages/user/user.js: Unexpected token (9:13)
What behavior are you expecting?
It should not break, I saw countless tutorials using this decorator.
I have imported the Input from angular2/core
Steps to reproduce:
1.
2.
3.
Ionic Version: 2
Browser & Operating System: Chrome
Run
ionic info
from terminal/cmd prompt:The text was updated successfully, but these errors were encountered: