samedi 18 novembre 2017

Ember.js: "this.$()" not working on component

Method this.$() is not working on a component. Following code:

app/components/example-component.js:

import Ember from 'ember';

export default Ember.Component.extend({

  exampleMethod() {
    console.log('"this" on exampleMethod():');
    console.log(this);
    console.log(this.$());
  },
});

Gets following error on web console:

TypeError: this.$ is not a function

How is this.$() to be used and how to get the jQuery element of a component?

Environment:

DEBUG: -------------------------------
DEBUG: Ember : 2.13.0
DEBUG: Ember Data : 2.13.1
DEBUG: jQuery : 3.2.1
DEBUG: Ember Simple Auth : 1.3.0
DEBUG: -------------------------------




Aucun commentaire:

Enregistrer un commentaire