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