UI for Zipcoin Blue

ng-module-loader.js 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import { Compiler, Injectable } from '@angular/core';
  2. /**
  3. * NgModuleFactoryLoader that uses SystemJS to load NgModuleFactory
  4. */
  5. var NgModuleLoader = (function () {
  6. function NgModuleLoader(_compiler) {
  7. this._compiler = _compiler;
  8. }
  9. NgModuleLoader.prototype.load = function (modulePath, ngModuleExport) {
  10. var offlineMode = this._compiler instanceof Compiler;
  11. return offlineMode ? loadPrecompiledFactory(modulePath, ngModuleExport) : loadAndCompile(this._compiler, modulePath, ngModuleExport);
  12. };
  13. NgModuleLoader.decorators = [
  14. { type: Injectable },
  15. ];
  16. /** @nocollapse */
  17. NgModuleLoader.ctorParameters = function () { return [
  18. { type: Compiler, },
  19. ]; };
  20. return NgModuleLoader;
  21. }());
  22. export { NgModuleLoader };
  23. function loadAndCompile(compiler, modulePath, ngModuleExport) {
  24. if (!ngModuleExport) {
  25. ngModuleExport = 'default';
  26. }
  27. return System.import(modulePath)
  28. .then(function (rawModule) {
  29. var module = rawModule[ngModuleExport];
  30. if (!module) {
  31. throw new Error("Module " + modulePath + " does not export " + ngModuleExport);
  32. }
  33. return compiler.compileModuleAsync(module);
  34. });
  35. }
  36. function loadPrecompiledFactory(modulePath, ngModuleExport) {
  37. return System.import(modulePath)
  38. .then(function (rawModule) {
  39. var ngModuleFactory = rawModule[ngModuleExport];
  40. if (!ngModuleFactory) {
  41. throw new Error("Module " + modulePath + " does not export " + ngModuleExport);
  42. }
  43. return ngModuleFactory;
  44. });
  45. }
  46. //# sourceMappingURL=ng-module-loader.js.map