Problem accessing Jquery in a custom .js file included in iconic project

I had a game developed by Createjs on html5 now i want to add this game to a page in iconi 3 project.
i installed jguery for ionic using npm

npm install jquery --save
typings install dt~jquery --global --save

and import it on top of ts file:

import * as $ from 'jquery'

and same method to install Createjs module

i did not add my costum .js file to index.htm instead i add it this way:

 ionViewDidLoad() {
var jQuery = $;
var script = document.createElement("script");
  script.src = "../assets/js/GameEngine.js";
  document.getElementsByTagName("head")[0].appendChild(script);
}

but in runtime i have error :

Runtime Error
jQuery is not defined
Stack
ReferenceError: jQuery is not defined
    at http://localhost:8100/assets/js/GameEngine.js:74:5
    at http://localhost:8100/assets/js/GameEngine.js:76:3

but $ is accessible in .ts file !
in other word i think since ionic is developing everyday there should be easiest way to include costum js files in this ts projects !?

1 Like