Angular 4 + ui-grid (transpile on browser)

356 views Asked by At

With Angularjs ui-grid used with Angular 4, I can't figure out how to avoid this:

   System.js successfully bootstrapped app.
   systemjs.config.js:117:9
   Unhandled Promise rejection: [$injector:modulerr] Failed to instantiate module $$UpgradeModule due to:                           zone.js:661:17
   [$injector:modulerr] Failed to instantiate module ng1Module due to:
   [$injector:modulerr] Failed to instantiate module ui.grid due to:
   [$injector:nomod] Module 'ui.grid' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
   http://errors.angularjs.org/1.6.6/$injector/nomod?p0=ui.grid
   [...]

See plunk: http://embed.plnkr.co/WxNwrbTXrdUHD5DU791U/

It seems that ui-grid is loaded before AngularJS. How to force the loading of ui-grid after the angularjs one?

Any idea?

UPDATE

I set up a working configuration with some tricks, mainly:

  • link for angularjs as first one in index.html
  • link to ui-grid just before the 'systemjs.config.js' one
  • keep a mapping for angularjs in 'systemjs.config.js':

    'angular': 'npm:/angular' + version.a1,

See plunk: https://plnkr.co/edit/bEaNtHxTvlTQ0cLOdC51

But I'm quite unhappy with this last mapping of 'angularjs'. I can't figure out why it's required. Even when working with local copies of packages (i.e. with 'npm:': '../node_modules'), it's still needed, and still linked to a CDN file ...

It seems that all this occurs since version 0.20.x of SystemJS.

Did I miss something obvious? Any idea?

0

There are 0 answers