...

/

Introduction to Helper Functions

Introduction to Helper Functions

Learn about helper functions and their types in Ember.

We'll cover the following...

Overview

Helper functions are JavaScript functions that can be called from a template. Ember’s template syntax limits what can be expressed to keep the structure of the application clear. If we need to calculate something in JavaScript, we can use a helper function. We can write a custom helper or use the built-in helper that Ember provides.

A helper takes a parameter passed to the function and returns a value. Here’s how we use a helper inside a template:

<p>{{helper arguments}}</p>

Generating helpers

In Ember CLI, we use the following command to generate a helper:

ember g helper <helper_name>

This command will create two files: ...