MrChocolatine / ember-service-helper

Simple template helper to inject services into templates

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

This fork has been frozen

The original add-on https://github.com/buschtoens/ember-service-helper has recently (27 July 2021) been updated:

https://github.com/buschtoens/ember-service-helper/releases/tag/v0.2.0

Please consider using it instead of this fork that I am going to stop maintaining (until the original add-on stops being maintained again).

ember-service-helper

CodeQL

Simple template helper to inject services into templates.

Credits go to @buschtoens for its initial implementation:
https://github.com/buschtoens/ember-service-helper

Installation

ember install MrChocolatine/ember-service-helper

Usage

Get a Service object

Example using ember-responsive.

{{#with (service "some-service") as |serviceX|}}
  <div>
    {{serviceX.propA}}
  </div>
  <div>
    {{serviceX.propB}}
  </div>
{{/with}}

Get directly a property from a Service

<div>
  {{service "some-service" "propA"}}
</div>

Related

About

Simple template helper to inject services into templates

License:MIT License


Languages

Language:JavaScript 84.1%Language:HTML 15.9%