0.10.0 • Published 9 years ago

ember-cli-controller-isactive v0.10.0

Weekly downloads
2
License
MIT
Repository
github
Last release
9 years ago

Build Status

Ember-cli-controller-isactive

Ever wanted to know if a controller is currently showing or not? Here's an addon that does that.

Example

  MyController = Ember.Controller.extend({
    activeObserver: (function() {
      if (this.get('isActive')) {
        console.log('i am currently active');
      } else {
        console.log('i am not active');
      }
    }).observes('isActive'),
    ...
  })

Override 'isActive' property name

If isActive conflicts with your app's logic you can override it, by overriding the activate-controller-via-route-mixin:

  import activateControllerViaRouteMixin from 'ember-cli-controller-isactive/mixins/activate-controller-via-route-mixin';

  export default activateControllerViaRouteMixin.extend({
    isActive: '_isActive'
  });

With this, the example above would look like:

  MyController = Ember.Controller.extend({
    activeObserver: (function() {
      if (this.get('_isActive')) {
        console.log('i am currently active');
      } else {
        console.log('i am not active');
      }
    }).observes('_isActive'),
    ...
  })

Installation

  • git clone this repository
  • npm install
  • bower install

Running

Running Tests

  • ember test
  • ember test --server

Building

  • ember build

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