Google News
logo
Aurelia - Interview Questions
What is Referencing Elements in Aurelia?
Use the ref binding command to create a reference to a DOM element. The ref command's most basic syntax is ref="expression". When the view is data-bound the specified expression will be assigned the DOM element.
  <template>
    <input type="text" ref="nameInput"> ${nameInput.value}
  </template>
The ref command has several qualifiers you can use in conjunction with custom elements and attributes :
 
* element.ref="expression" : create a reference to the DOM element (same as ref="expression").

* attribute-name.ref="expression" : create a reference to a custom attribute's view-model.

* view-model.ref="expression" : create a reference to a custom element's view-model.

* view.ref="expression" : create a reference to a custom element's view instance (not an HTML Element).

* controller.ref="expression" : create a reference to a custom element's controller instance.
Advertisement