Sha256: 03668b7553f1219bf119a628d4757deba8109f548d9862428918a3ae4fd59673

Contents?: true

Size: 1.2 KB

Versions: 2

Compression:

Stored size: 1.2 KB

Contents

import { Object as EmberObject } from 'ember-runtime';
import ControllerMixin from './lib/controller_mixin';
import { InjectedProperty } from 'ember-metal';

/**
@module @ember/controller
*/

/**
  @class Controller
  @extends EmberObject
  @uses Ember.ControllerMixin
  @public
*/
const Controller = EmberObject.extend(ControllerMixin);

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

  Example:

  ```app/controllers/post.js
  import Controller, {
    inject as controller
  } from '@ember/controller';

  export default Controller.extend({
    posts: 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.

  @method inject
  @static
  @for @ember/controller
  @since 1.10.0
  @param {String} name (optional) name of the controller to inject, defaults
         to the property's name
  @return {Ember.InjectedProperty} injection descriptor instance
  @public
*/
export function inject(name, options) {
  return new InjectedProperty('controller', name, options);
}

export default Controller;

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
discourse-ember-source-3.5.1.1 dist/es/@ember/controller/index.js
discourse-ember-source-3.5.1.0 dist/dist/es/@ember/controller/index.js