Catalog / Ember.js Cheat Sheet
Ember.js Cheat Sheet
A quick reference guide for Ember.js, covering components, routing, data management, and testing.
Ember Essentials
Application Setup
|
|
|
|
|
|
Basic Concepts
Components |
Reusable UI elements. Defined with |
Routes |
Manage application state and URL transitions. Define models and actions. |
Templates |
Handlebars templates for rendering UI. |
Models |
Represent data. Often fetched from an API using Ember Data or custom solutions. |
Services |
Singletons for managing global application state or logic. |
Ember CLI |
The command-line interface for managing Ember projects. |
Components
Component Definition
Component JavaScript file (
|
Component template file (
|
Component Arguments
Passing Arguments |
<MyComponent @name=“World” /> |
Accessing Arguments |
Use |
Component Actions
Defining Actions |
|
Invoking Actions in Template |
<button {{on “click” this.myAction}}>Click Me |
Routing
Route Definition
Route JavaScript file (
|
Route template file (
|
Router Configuration
Configure routes in
|
Linking Between Routes
Using the |
{{#link-to “about”}}About{{/link-to}} |
Passing Model Data |
{{#link-to “posts.show” post}}View Post{{/link-to}} |
Data Management
Ember Data (Basic)
Defining a model (
|
Fetching data in a route:
|
Computed Properties
|
Services
Creating a service (
|
Injecting a service:
|