question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

property binding syntax: [label] instead of this [label]="label"

See original GitHub issue

I’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:open
  • Created 6 years ago
  • Reactions:5
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
briancodescommented, Dec 29, 2017

That might make it more difficult to tell the difference between attribute directives and inputs without digging into the underlying code, especially if using templateURL.

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 template

4reactions
OwenKelvincommented, Apr 6, 2020

The syntax { label } can also be easy to understand given that in ES2015 we are already using { label } to mean { label: label }

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found