An implementation of the {{ref}}
element modifier.
Heavily inspired by ember-on-modifier and @ember/render-modifiers
.
ember install ember-ref-modifier
- Ember.js v2.18 or above
- ember-cli v2.13 or above
class Component {
@action callback(node) {
this.node = node;
}
}
import Component from '@ember/component';
export default class BritneySpearsComponent extends Component {
button!: DOMNode
}
This is essentially equivalent to:
didInsertElement() {
super.didInsertElement();
this.set('button', this.element.querySelector('button'));
}
It will also re-register property, if any of the passed parameters change.
Old syntaxis {{ref 'pathName' context}}
will be deprecated in version 1.0.0.
Use {{ref context 'pathName'}}
instead.