From cc75067669cf84ce881dd3f97496494b9a6b4c31 Mon Sep 17 00:00:00 2001 From: Godfrey Chan Date: Mon, 11 Jan 2021 18:33:14 -0800 Subject: [PATCH] Fix beta build There is a workaround for https://github.com/emberjs/ember.js/issues/19334 Revert this commit when the upstream bug is fixed. --- .../tutorial/part-1/08-working-with-data.md | 8 +++++--- .../tutorial/part-2/12-provider-components.md | 18 ++++++++++-------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/markdown/tutorial/part-1/08-working-with-data.md b/src/markdown/tutorial/part-1/08-working-with-data.md index 925fed0..fbc864a 100644 --- a/src/markdown/tutorial/part-1/08-working-with-data.md +++ b/src/markdown/tutorial/part-1/08-working-with-data.md @@ -348,21 +348,23 @@ The last change we'll need to make is to our `index.hbs` route template, where w Let's see how. + + ```run:file:patch lang=handlebars cwd=super-rentals filename=app/templates/index.hbs @@ -8,5 +8,5 @@ ``` We can use the `{{#each}}...{{/each}}` syntax to iterate and loop through the array returned by the model hook. For each iteration through the array—for each item in the array—we will render the block that is passed to it once. In our case, the block is our `` component, surrounded by `
  • ` tags. -Inside of the block we have access to the item of the *current* iteration with the `{{rental}}` variable. But why `rental`? Well, because we named it that! This variable comes from the `as |rental|` declaration of the `each` loop. We could have just as easily called it something else, like `as |property|`, in which case we would have to access the current item through the `{{property}}` variable. +Inside of the block we have access to the item of the *current* iteration with the `{{property}}` variable. But why `property`? Well, because we named it that! This variable comes from the `as |property|` declaration of the `each` loop. We could have just as easily called it something else, like `as |rental|`, in which case we would have to access the current item through the `{{rental}}` variable. Now, let's go over to our browser and see what our index route looks like with this change. diff --git a/src/markdown/tutorial/part-2/12-provider-components.md b/src/markdown/tutorial/part-2/12-provider-components.md index a000735..93042f4 100644 --- a/src/markdown/tutorial/part-2/12-provider-components.md +++ b/src/markdown/tutorial/part-2/12-provider-components.md @@ -58,6 +58,8 @@ Wait...why don't we just refactor the search box into a component? Once we do th Let's start simple again and begin our refactor by creating a new template for our component, which we will call `rentals.hbs`. + + ```run:file:create lang=handlebars cwd=super-rentals filename=app/components/rentals.hbs
      - {{#each @rentals as |rental|}} -
    • + {{#each @rentals as |property|}} +
    • {{/each}}
    @@ -85,8 +87,8 @@ There is one minor change to note here: while extracting our markup into a compo - - -
      -- {{#each @model as |rental|}} --
    • +- {{#each @model as |property|}} +-
    • - {{/each}} -
    - @@ -283,12 +285,12 @@ Well, in order to answer this question, let's look at how the data that we're yi ```run:file:patch lang=handlebars cwd=super-rentals filename=app/components/rentals.hbs @@ -7,5 +7,7 @@
      -- {{#each @rentals as |rental|}} --
    • +- {{#each @rentals as |property|}} +-
    • - {{/each}} + -+ {{#each results as |rental|}} -+
    • ++ {{#each results as |property|}} ++
    • + {{/each}} +