Skip to content

Instantly share code, notes, and snippets.

@Panman82
Last active August 11, 2016 16:26
Show Gist options
  • Save Panman82/f8d7d6472a338626876a1eedbd87ea77 to your computer and use it in GitHub Desktop.
Save Panman82/f8d7d6472a338626876a1eedbd87ea77 to your computer and use it in GitHub Desktop.
Add an `inactiveClass` to Ember `{{link-to}}`'s
// app/initializers/linkto-inactive-class.js
import Ember from 'ember';
export function initialize() {
Ember.LinkComponent.reopen({
classNameBindings : ['inactive'],
inactiveClass : false, // must implicitly set
inactive : Ember.computed('active', function(){
// Note: `activeClass` MUST return something truthy for this to work
return ( this.get('active') ? false : this.get('inactiveClass') );
})
});
}
export default {
name: 'linkto-inactive-class',
initialize
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment