Skip to content

kturney/ember-lookup

Repository files navigation

ember-lookup

Latest NPM release TravisCI Build Status Ember Observer Score

This provides a helper that allows using Ember.getOwner()#lookup from templates.

Installation

ember install ember-lookup

Usage

Lookup a service

By default, ember-lookup will lookup a service.

{{#with (lookup 'my-service') as |myService|}}
  {{! use service }}
{{/with}}

Lookup anything registered with ember

The type of the object to lookup may be provided as the second parameter.

{{#with (lookup 'environment' 'config') as |config|}}
  {{! use config }}
{{/with}}
{{#with (lookup 'foo' 'bar') as |foo|}}
  {{! use foo of type bar }}
{{/with}}

If using ember-let

{{let myService=(lookup 'my-service')}}

Credit where credit is due

Basically copied from this issue by rwjblue in ember-with-service.

Running Tests

  • npm test (Runs ember try:each to test your addon against multiple Ember versions)
  • ember test
  • ember test --server

Building

  • ember build

For more information on using ember-cli, visit https://ember-cli.com/.

About

inject registered objects into your templates

Resources

License

Stars

Watchers

Forks

Packages

No packages published