# Controllers & Templates

### What is a Controller?

A Controller is routable object which receives a single property from the Route – model – which is the return value of the Route's model() method.

The model is passed from the Route to the Controller by default using the setupController() function. The Controller is then often used to decorate the model with display properties such as retrieving the full name from a name model.

A Controller is usually paired with an individual Route of the same name.

### When should we create a Controller?

* We want to pass down actions or variables to share with a Route’s child components
* We have a computed property that depends on the results of the model hook
* We need to support query parameters

## Templates

Template and controller are essentially the same thing – two sides of the same coin. All the controller properties are the template’s.

Each template will be rendered into the `{{outlet}}` of its parent route's template. For example, the `posts.new` route will render its template into the `posts.hbs`'s `{{outlet}}`, and the `posts` route will render its template into the `application.hbs`'s `{{outlet}}`.<br>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://prospect-io.gitbook.io/developer-playbook/our-stack/ember.js/controllers-and-templates.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
