New bracket invocation with paths


#1

Hi,

I’m using Ember 3.2 and have installed the ember-angle-bracket-invocation-polyfill and try as I might I cannot get a simple component call for the following to work:

{{users/login-form}}

I have tried every combination of

<users.LoginForm />

I can think of (w.r.t. upper/lowercase letters, dashes and slashes) with no success.

Here is what the doc says about using the polyfill:

 Supports invoking components via angle brackets with self-closing syntax
<FooBar />
Supports invoking components via angle brackets using paths
<some.thing></some.thing>

I’m confused about the “path” part. I figure the path in the example above is “some”, and thus the component’s name is “thing” - but we were told that components must always consist of two words with a dash, so “thing” would not be allowed.

I’m obviously missing something and/or reading this completely wrong. Can someone let me know how I should reference my component using angle brackets?


#2

I am assuming that {{users/login-from}} is attempting to invoke a component at app/components/users/login-form.js? If that is correct, then this invocation won’t be able to be changed to angle bracket invocation. The Angle Bracket Invocation RFC has this to say:

In today’s semantics, {{foo/bar}} does not try to lookup this.foo.bar and invoke it as a component. Instead, it is used as a filesystem scoping syntax. Since this feature will be rendered unnecessary with Module Unification, we recommend apps using “slash components” to migrate to alternatives provided by Module Unification (or, alternatively, keep using curly invocations for this purpose).

tldr; subfolder invocation is not a feature of angle bracket invocation.


#3

I’m sorry I forgot to mention before, the RFC in this section is talking about invoking “paths” in terms of bound property paths within the template. Something like:

{{#with (hash foo=(component 'something-foo')) as |grab-bag|}}
  <grab-bag.foo />
{{/with}}

Where the thing “path” means here is a property lookup in the lexical template context.


#4

Thanks for the reply, Robert. You know, I actually read the Angle Bracket RFC - but apparently not close enough. That paragraph was in the Dynamic Invocations section, and as I didn’t think that applied to me I remember “speed skimming” as I was getting towards the end.

My bad. Sorry.

And thanks again.


#5

Not worries! I’m just glad folks are trying it out :smiley: