Ember.inject.controller()

controller (name) Ember.InjectedPropertypublic

Defined in packages/ember-runtime/lib/controllers/controller.js:31
Available since 1.10.0

Creates a property that lazily looks up another controller in the container. Can only be used when defining another controller.

Example:

App.PostController = Ember.Controller.extend({
  posts: Ember.inject.controller()
});

This example will create a posts property on the post controller that looks up the posts controller in the container, making it easy to reference other controllers. This is functionally equivalent to:

App.PostController = Ember.Controller.extend({
  needs: 'posts',
  posts: Ember.computed.alias('controllers.posts')
});

Parameters:

name String
(optional) name of the controller to inject, defaults to the property's name

Returns:

Ember.InjectedProperty
injection descriptor instance
doc_EmberJs
2016-11-30 16:51:30
Comments
Leave a Comment

Please login to continue.