Skip to content

09.0.0 Use a Component For Rating

bazzel edited this page Nov 14, 2014 · 1 revision

What you will learn

  • Create a component for rating

Before you start

See the installation instructions. Use tag 9.0.0.

Add a Component

  • Open app/templates/products/show.hbs and within the {{#each reviews}} helper, replace all the <span class='glyphicon... tags with {{star-rating starCount=rating}}.
  • Inspect the error shown in the Console tab in the browser. Ember is missing the star-rating component, so let's create this.
  • In the terminal, enter ember g component star-rating.
  • Open app/templates/components/star-rating.hbs and replace the content with the code from this gist from star-rating.hbs.
  • Open app/components/star-rating.js and replace the content with the code from this gist from star-rating.js.