home
  • Blog
1.12
  • Getting Started
  • Concepts
  • The Object Model
  • Application
  • Templates
  • Routing
  • Components
  • Controllers
  • Models
  • Views
    • Introduction
    • Defining a View
    • Handling Events
    • Inserting Views in Templates
    • Adding Layouts to Views
    • Customizing a View's Element
    • Built-in Views
    • Manually Managing View Hierarchy
  • Enumerables
  • Testing
  • Configuring Ember.js
  • Ember Inspector
  • Cookbook
  • Understanding Ember.js
  • Contributing to Ember.js
Old Guides - You are viewing the guides for Ember v1.12.0.
Go to v5.0.0

Introduction

Edit pencil

Because Handlebars templates in Ember.js are so powerful, the majority of your application's user interface will be described using them. If you are coming from other JavaScript libraries, you may be surprised at how few views you have to create.

Views in Ember.js are typically only created for the following reasons:

  • When you need sophisticated handling of user events
  • When you want to create a re-usable component

Often, both of these requirements will be present at the same time.

Event Handling

The role of the view in an Ember.js application is to translate primitive browser events into events that have meaning to your application.

For example, imagine you have a list of todo items. Next to each todo is a button to delete that item:

Todo List

The view is responsible for turning a primitive event (a click) into a semantic event: delete this todo! These semantic events are first sent up to the controller, or if no method is defined there, your application's router, which is responsible for reacting to the event based on the current state of the application.

Todo List

left arrow
Frequently Asked Questions
Defining a View
right arrow
On this page

  • Event Handling
Team Sponsors Security Legal Branding Community Guidelines
Twitter GitHub Discord Mastodon

If you want help you can contact us by email, open an issue, or get realtime help by joining the Ember Discord.

© Copyright 2023 - Tilde Inc.
Ember.js is free, open source and always will be.


Ember is generously supported by
blue