2

html

<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.8/angular-aria.min.js"></script>

webpack

  externals: {
    "angular": "angular",
    "angular-aria": "window.angular.module['ngAria']",
}

index.js

import ngAria from 'angular-aria';   

export default angular
    .module( 'app.directives', ['ngAria'] )
    .name;

console feedback:

'Uncaught ReferenceError: aria is not defined'

the code related to feedback

module.exports = angular-aria;

on top of this issue, two extra questions

  1. is it possible to use CDN with different complier like rollup?
  2. how to detect angular-aria loaded? (so i can provide fallback)

My bad, by following the Bower set, you can achieve this I shall check the Doc earlier

SOLUTION

html

<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.8/angular-aria.min.js"></script>
<script>
if (!window.angular.module['ngAria']) { document.write('<script type="text/javascript" src="/content/Dotcom/js/vendor/angular-aria.min.js"><\/script>'); } 
</script>

webpack

  externals: {
    "angular": "angular",
}

index.js

import ngAria from 'angular-aria';   

export default angular
    .module( 'app.directives', ['ngAria'] )
    .name;
Seeliang
  • 2,321
  • 1
  • 13
  • 18
  • for [2] check here http://stackoverflow.com/questions/18731830/detect-if-angular-dependencies-angular-route-angular-resource-etc-are-loaded – Seeliang Nov 28 '16 at 00:24

0 Answers0