Using development helpers
Debugging your template is a task that you'll often use. Here are the steps to do this.
How to do it...
The most basic way of debugging Ember templates is to use {{log}}
and {{debugger}}
.
- Create a new Ember application. Create a new component called
log-example
. Run this command in the rootapplication
folder:$ ember g component log-example
This will create a new component template and JavaScript files.
- Open the
log-example.js
file in theapp/components
folder and a new property calledhelloText
:// app/components/log-example.js import Ember from 'ember'; export default Ember.Component.extend({ helloText: 'Hello World' });
This is a simple component with just one property.
- Open the
log-example.hbs
file in theapp/templates/components ...
Get Ember.js Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.