G
G
GaserV2017-04-11 20:09:15
Ember.js
GaserV, 2017-04-11 20:09:15

Why are the selects not being styled?

Such a problem. There is a component corresponding to the template component. In him:

import Ember from 'ember';

export default Ember.Component.extend({
  store: Ember.inject.service(),

  didInsertElement(){
    this.$("select").select2({
      minimumResultsForSearch: -1
    });
  },
});

As a result, I get an error in the console Uncaught TypeError: this.$(...).select2 is not a function.
In ember-cli-build:
/* global require, module */
var EmberApp = require('ember-cli/lib/broccoli/ember-app');

module.exports = function(defaults) {
  var app = new EmberApp(defaults, {
    sassOptions: {
      extension: 'sass'
    }
  });

  app.import('vendor/js/jquery-1.12.2.min.js');
  app.import('vendor/js/select2.min.js');

  return app.toTree();
};

The directory and the file are in place, in theory it should have been connected, but it is not styled. Why?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stanislav Romanov, 2017-04-11
@Kaer_Morchen

In the template of this component, does the html select element itself exist?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question