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

Interfacing a component with the rest of the application

Components, as mentioned earlier, are not completely sandboxed, but they can interact with the rest of the application in the following ways:

  • Bind to properties
  • Send actions

We have already seen how components are able to bind to other application properties by passing the properties in the template expressions:

  {{post-input posts=model}}

Components also have the ability to send their actions to controllers in an application. To demonstrate this, let's create a simple checkout button for an e-commerce site:

{{! template}} <script type="text/x-handlebars" id="components/checkout-button"> add to cart </script> // add to cart component App.CheckoutButtonComponent = Ember.Component.extend({ tagName: ...

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