jeudi 6 avril 2017

ember.js include custom js

Attempting to wrap my head around Ember.js. Seems I understand the complex things, but miss out on the little things.

How would one go about adding an example.js file? For simplicity, let's say the example.js file only contains:

(function(){
  console.log("example is alive in console");
})(window);

This should display "example is alive in console" within the browser console.

I have tried: adding app.import('vendor/javascripts/example.js'); within ember-cli-build.js and adding <script src="vendor/javascripts/example.js"></script> to index.html

Console is showing

ⓧ GET http://localhost:4200/vendor/javascripts/example.js
DEBUG: -------------------------------
DEBUG: Ember : 2.11.3
DEBUG: Ember Data : 2.12.1
DEBUG: jQuery : 3.2.1
DEBUG: -------------------------------
ⓧ GET http://localhost:4200/vendor/javascripts/example.js

All of the answers I have found stated that just adding custom.js to vendor file works. Sadly, I am missing something.




Aucun commentaire:

Enregistrer un commentaire