Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Donmclean/6f3cb24da65ba70a6c5f507ec43a7c01 to your computer and use it in GitHub Desktop.
Save Donmclean/6f3cb24da65ba70a6c5f507ec43a7c01 to your computer and use it in GitHub Desktop.
Properly integrate non-AngularJS libraries in your AngularJS application
function LodashFactory($window) {
if(!$window._){
// If lodash is not available you can now provide a
// mock service, try to load it from somewhere else,
// redirect the user to a dedicated error page, ...
}
return $window._;
}
// Define dependencies
LodashFactory.$inject = ['$window'];
// Register factory
yourModule.factory('_', LodashFactory);
@anthonyRV
Copy link

Where do i need to include de script tag reference to the library??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment