I Get An Error In CreateJS: "createjs Is Not Defined"
Solution 1:
I had a similar problem - in my case I added the createjs-module npm package for webpack (I use it in the Laravel wabpack mix). It appeared that there was an issue with the scope, so I had to ensure that createjs is global. So you can try to do the following:
Install the npm module (in the console)
npm install createjs-module --save
Initialize the createjs (in your js file)
this.createjs = {};
Make createjs global (in your js file)
window.createjs = this.createjs;
Import the module (in your js file)
require('createjs-module');
And now you can use it as usual :)
Reference: CreateJS GitHub Issues
Solution 2:
I assume createjs is defined in the window object. To be accessible in angular js you need to make it injectabled like this :
angular.module('myApp', [])
.constant('createjs', window.createjs)
Then you can inject it into your controller for example :
controller: function(createjs) {
var stage = new createjs.Stage(canvas);
}
You can also refer to it by using $window :
controller: function($window) {
var stage = new $window.createjs.Stage(canvas);
}
Solution 3:
I just get some tests on it and i verify if the library EaselJS which is used for createjs is injected but it was not injected in the Bower.json file. so i had to injected manually in the bower.json file and it's working.
Post a Comment for "I Get An Error In CreateJS: "createjs Is Not Defined""