Last active
August 11, 2016 16:26
-
-
Save Panman82/f8d7d6472a338626876a1eedbd87ea77 to your computer and use it in GitHub Desktop.
Add an `inactiveClass` to Ember `{{link-to}}`'s
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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