How to reference a JS library in Angular

Code that goes in the relevant controller:

angular
.module(‘editor’)
.controller(‘IndexController’, function($scope, supersonic) {
var deferred = $q.defer();
var dependencies =
[
‘jquery-2.1.4.min.js’,
‘annotator-full.min.js’
];

// Load the dependencies
$script(dependencies, function()
{
// all dependencies have now been loaded by so resolve the promise
$rootScope.$apply(function()
{
deferred.resolve();
});
});

return deferred.promise;

});

jQuery(function ($) {
$(‘#content’).annotator();
supersonic.logger.log(‘working?’);
throw new Error(“Oh no, there’s a bug in my app!”);
});

Advertisements
How to reference a JS library in Angular

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s