Skip to content

[DOC lts] Angle Bracket invocation - #17554

Merged
rwjblue merged 3 commits into
emberjs:masterfrom
cah-danmonroe:anglebrackets
Feb 5, 2019
Merged

rwjblue merged 3 commits into
emberjs:masterfrom
cah-danmonroe:anglebrackets

Conversation

@cah-danmonroe

Copy link
Copy Markdown

This is the initial angle bracket invocation conversion for the docs. It should be merged back through version 3.4

@cah-danmonroe cah-danmonroe changed the title [DOC] Angle Bracket invocation [DOC lts] Angle Bracket invocation Feb 2, 2019

@locks locks left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some bits and bobs


```
<PersonForm as |form|>
{{form.nameInput placeholder="Username"}}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{{form.nameInput placeholder="Username"}}
<form.nameInput @placeholder={{"Username"}} />

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{{form.nameInput placeholder="Username"}}
<form.nameInput @placeholder="Username" />

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wycats which of these is preferable?

@cah-danmonroe cah-danmonroe Feb 3, 2019 •

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used <form.nameInput @placeholder={{"Username"}} /> for now

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally speaking there is no need for curlies around a static string. Its not "wrong", just a bit odd...

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the curlies

mutate a value. For example:

```handlebars
<MyChild @childClickCount={{this.totalClicks}} @click-count-change={{action (mut totalClicks))}} />

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This example needs to be revised (both syntax).

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure what you mean here.

@rwjblue
rwjblue requested review from jenweber and locks February 4, 2019 14:14

```handlebars
{{some-component name=(concat firstName " " lastName)}}
<SomeComponent @name={{concat firstName " " lastName}} />

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You actually don't need concat in this example at all (this was one of the selling points of angle bracket invocation). This works perfectly:

<SomeComponent @name="{{firstName}} {{lastName}}" />

Maybe we don't need dual examples in this case?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left both examples but explained that it's not needed for angle bracket invocation.

You can use the `if` helper inside another helper as a nested helper:

```handlebars
<SomeComponent height={{if isBig "100" "10"}} />

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<SomeComponent height={{if isBig "100" "10"}} />
<SomeComponent @height={{if isBig "100" "10"}} />

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

You can use the `unless` helper inside another helper as a subexpression.

```handlebars
<SomeComponent height={{unless isBig "10" "100"}} />

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<SomeComponent height={{unless isBig "10" "100"}} />
<SomeComponent @height={{unless isBig "10" "100"}} />

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@rwjblue rwjblue left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems good to me. Going to go ahead and land (to avoid annoying rebase issues), but if @emberjs/learning-team-managers have any tweaks they'd like to see we can get them in a follow up PR...

@rwjblue
rwjblue merged commit 64ee6a6 into emberjs:master Feb 5, 2019
@locks

locks commented Feb 5, 2019

Copy link
Copy Markdown
Contributor

Sounds good, thanks for pushing it forward!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants