Skip to content

provide simple example of addDependency #8

@amergin

Description

@amergin

How is one supposed to use addDependency to include external libraries? Consider this example:

  • I need to include lodash into my WW
  • I create a service that returns the lodash object:
angular.module('ext.lodash', []).factory('_', function() {
    // WWs don't have access to 'window', will it affect this return value?
    return window._;
});
  • I use addDependency and expect it to be injected:
WorkerService.addDependency('_', 'ext.lodash', 'https://cdnjs.cloudflare.com/ajax/libs/lodash.js/3.10.0/lodash.min.js');

This later results in an DI error when calling createAngularWorker. What am I doing wrong? I consider adding external libraries one of the most important feature since they allow me to include relevant math and utility libraries.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions