property binding syntax: [label] instead of this [label]="label"
See original GitHub issueI’m submitting a…
[ X] Feature request
Current behavior
@Component({
template: ' <my-other [label]="label"></my-other>'
//...
})
export class TestComponent {
label = 'hello';
}
Expected behavior
Having to only type this
<my-other [label]></my-other>
Or even better with a self closing tag
<my-other [label] />
I assume this is not yet the case because angular wants to be close to custom elements spec. Nevertheless that’d be great.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:5
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Binding syntax - Angular
Angular binding distinguishes between HTML attributes and DOM properties. ... To control the state of the button, set the disabled property instead.
Read more >Using label elements to associate text labels with form controls
The objective of this technique is to use the label element to explicitly associate a form control with a label. A label is...
Read more >What is the XAML syntax for setting a Trigger on a Label?
Does anyone know the syntax to do this? The following code results in "Binding cannot be used in Property": <DataTemplate x:Key=" ...
Read more >Label - .NET MAUI | Microsoft Learn
The .NET MAUI Label displays single-line and multi-line text in an app. ... Property element syntax --> <Label> <Label.Text> First line Second line...
Read more >aria-labelledby - Accessibility - MDN Web Docs
The aria-labelledby property enables authors to reference other elements ... including aria-label , <label> , and the element's inner text.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
That might make it more difficult to tell the difference between
attribute directives
andinputs
without digging into the underlying code, especially if usingtemplateURL
.Each time you would see a
[someName]
in a template tag, you would have to look at the underlying component to figure out if it is an input or a directive - there would be no way of knowing by just looking at the templateThe syntax
{ label }
can also be easy to understand given that in ES2015 we are already using{ label }
to mean{ label: label }