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.

<angle-bracket> components

See original GitHub issue

What are the plans on supporting <angle-bracket> components?

The old {{mustache-component}} syntax will not be abandoned before 3.0, as the new syntax won’t land until 2.1. Therefore Emblem can’t just make the new syntax the default one.

We need a way to indicate that the new syntax should be used. Alternatively we could upgrade the major version number and do the opposite by using the new <angle-bracket> syntax by default, while keeping the old {{mustache-component}} syntax accessible through said indicator.

Obviously, this issue doesn’t need to be addressed until Ember 2.0 comes out, but I’m curious for your ideas.

Personally, I’d prefer the latter option and bump the major version number, so the new syntax can be used by default without additional indicators, while still enabling users to use legacy components, as <angle-bracket> components are the way to go.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:22 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
machtycommented, Dec 26, 2015

It was probably a mistake to create a white list of known HTML attributes that determines whether foo is interpreted as {{foo}} or <foo>, because it’s a bit confusing and not exactly future proof (Glimmer angle bracket components as a primary example, but also new additions to HTML elements, etc).

Emblem isn’t 1.0 yet so technically the rules for semantic versioning don’t apply, but since it’s been around for a few years, it’s fair to say it’s post 1.0 in spirit, so I’m pretty hesitant to “fix” the white-listing mistake if there’s any other way around it, since it’ll break everyone’s templates.

I haven’t seen anyone mention it in this thread, but as a reminder, you can prefix with % to force interpretation as an HTML element, e.g. %foo produces <foo>. Angle-bracket Glimmer components are being designed such that the way you bind attributes, pass in properties, etc., is the same syntax as what how you’d do such things with a normal HTML component, e.g. in Glimmer you can do <div class={{foo}}> or <my-component items={{things}}>.

Emblem already specifies how to pass in attributes to HTML elements, e.g. %div class="wat" (the % is optional since div is on the whitelist) so maybe going forward the safest thing to do is stick with % as the way to prefix angle-bracket components.

%my-component items=things

produces

<my-component item={{things}}></my-component>

This I believe is working syntax today. We’ll probably need to add things like block syntax for angle bracket components and maybe some other things that come along, but am I missing anything fundamental about % limitations?

Separately, we can decide:

  1. Should we remove the white-list and treat ALL un-prefixed identifiers as angle-brackets, and if so, when? (This would break older Emblem templates)
  2. Perhaps as a midterm solution we can treat all unprefixed identifiers with dashes (a requirement for Glimmer components is that there is a dash in the name) as angle brackets.

How’s that all sound?

1reaction
kjhangianicommented, Feb 8, 2017

What’s the latest status on this? Are angle bracket components supported in the latest emblem? We’ve finally updated to ember 1.13, and are looking to migrate to glimmer components, but can’t find any updates on the latest syntax.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angle Bracket Syntax - Ember Guides
The angle bracket invocation syntax is useful when you wish to pass arbitrary HTML attributes to the component. This is possible because in...
Read more >
Angle Bracket Invocation for Nested Components (3.10)
Ember 3.4 introduced Angle Bracket components, but we never had a way to use angle brackets with components in nested directories. Ember 3.10...
Read more >
Angle Bracket Components: A first look - EmberMap
Rejoice! Angle bracket invocation now supports nested components ! Let's see how this sweet new syntax improves the clarity of our templates.
Read more >
Ember Templates: Classic vs Angle Bracket Syntaxes
Angle bracket syntax implements attributes in a similar way, allowing the developer to apply these attributes to a DOM node somewhere in the...
Read more >
Three Reasons to Switch to Angle Bracket Syntax in Ember
Angle bracket syntax uses an annotation is to indicate that a parameter is being passed to the component. Standard HTML attributes don't require ......
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