O'Reilly logo

Mastering Ember.js by Mitchel Kelonye

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Defining a component

Components are a higher-level construct of Ember.js views, and therefore, to define one, we'll need to define either or both of the following two Ember.js objects:

  • The component's class
  • The component's template

The class is usually extended from the Ember.Component class in the following signature:

MyAppNamespace.ComponentNameComponent = Ember.Component.extend();

The component template is then defined and named using Ember.js conventions. For example, the template for the preceding component will be named as:

components/component-name

The bundled sample of this chapter includes a simple application that utilizes several components. This application allows users to upload and rate photos as shown in the following screenshot:

The application ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required