-
Notifications
You must be signed in to change notification settings - Fork 25.1k
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
Angular2, unable to assign calculated [for] property on a <label> #7516
Comments
Try using |
@brandonroberts thanks... still climbing the hill that is learning Angular2 ... It was just wild that |
@pkozlowski-opensource thanks, I'd searched for it... per your comment, would be nice if there were a property for this, even if it was only a mapping to attr.for, since I can see this being a huge piece of frustration... either way lesson learned... unfortunately, given the relatively common use of In either case, a better error message would probably be the best alternative to adding |
It is called property binding, so it binds to properties only, not to attributes. The property is called
|
Then the |
Using I agree with @tracker1 that we should improve the error message here. @pkozlowski-opensource wdyt? |
@tracker1 The property name is defined in the HTML standard and has been called that way since the very first formal standardization of the DOM. That’s from 1998. I don’t think Angular should go around renaming standardized properties now. |
@poke Again, I'd be okay with a better error message... in this specific case, for a |
@tracker1 that's because the property |
@PascalPrecht I think that we could internally (in the compiler) re-map Would anyone be interested in checking cross-browser support for |
This improves ergonomics a bit by allowing people to write: `<label [for]="ctxProp"></label>`. This is similar to the exisiting class -> className mapping. Closes angular#7516
The error message is now: |
This improves ergonomics a bit by allowing people to write: `<label [for]="ctxProp"></label>`. This is similar to the exisiting class -> className mapping. Closes angular#7516
This improves ergonomics a bit by allowing people to write: `<label [for]="ctxProp"></label>`. This is similar to the existing class -> className mapping. Closes #7516
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
[X] bug report
[X] feature request
Bug in existing behavior, feature for proposed solution
I am creating an Angular2 component, in the template, I am wanting to create an
<input>
, with a calculated[id]
property, which works.I am also wanting to create a
<label>
with a matching[for]
property, so that the label is appropriately bound to the input (clicking will focus said input).The property should be calculated, and the result outputted into the
<label>
like the[id]
property works for<input>
;The current behavior doesn't support a necessary feature for HTML output in dealing with label association to form controls.
Angular version: 2.0.0-beta.7
Browser: all
Language: ES2016+ (Babel)
It would be nice if "unknown" native properties simply run and output the result,as
[id]
works on the<input>
element.The text was updated successfully, but these errors were encountered: