Skip to content

Instantly share code, notes, and snippets.

@turboMaCk
Last active August 29, 2015 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save turboMaCk/26a4fd9fb14e0538e698 to your computer and use it in GitHub Desktop.
Save turboMaCk/26a4fd9fb14e0538e698 to your computer and use it in GitHub Desktop.
import Ember from 'ember';
export default Ember.Component.extend({
tagName: 'a',
classNameBindings: ['active'],
attributeBindings: ['href'],
active: false,
href: '#',
title: 'add title',
property: null,
value: null,
init: function() {
this._super();
this.classSetter();
},
classSetter: function() {
this.set('active', this.get('property') === this.get('value'));
}.observes('property'),
click: function(e) {
e.preventDefault();
this.set('property', this.get('value'));
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment