Add an example on how to access controller in gjs/gts templates

Open Beginner friendly
#2,183 2 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Documentation
Clarity
Clearly specified
Activity status
Stale
Tech stack
html, javascript
Domain
documentation

Research direction

Start with the routing/controllers guide page linked in the issue and compare its current example with the provided valid GJS template. Update or replace the example to show controller access in GJS/GTS templates, then verify that the page renders correctly and the example is complete.

Written by the indexing model from the issue text.

Description

It would be helpful to have here an example here: https://guides.emberjs.com/v6.9.0/routing/controllers/

HEre is the current exmaple with gjs valid code, could be added to the page or replaced

<template>
  <h1>{{@model.title}}</h1>
  <h2>by {{@model.author}}</h2>

  <div class='intro'>
    {{@model.intro}}
  </div>
  <hr>

  {{#if @controller.isExpanded}}
    <button type="button" {{on "click" @controller.toggleBody}}>Hide Body</button>
    <div class="body">
      {{@model.body}}
    </div>
  {{else}}
    <button type="button" {{on "click" @controller.toggleBody}}>Show Body</button>
  {{/if}}
</template>

Thanks in advance

Dominant language
HTML
Stars
161
Forks
513
Avg merge
4d 9h
Merged PRs (30d)
4

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ember-learn/guides-source

All issues in ember-learn/guides-source

Similar issues

More Documentation issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.