I have upgrade angular1 app to bootstrap with angular2 (upgrade option), but after importing angular with systemJS config:
map: {... 'angular': 'npm:angular/angular.js' ... }
The browser send error:
systemjs.import error: Error: (SystemJS) angular.module is not a function
TypeError: angular.module is not a function
at execute (http://msoqa05.devlab.ad:8088/home/bl/app.module.js:88:21)
at ZoneDelegate.invoke (https://unpkg.com/[email protected]?main=browser:242:26)
at Zone.run (https://unpkg.com/[email protected]?main=browser:113:43)
at https://unpkg.com/[email protected]?main=browser:520:57
at ZoneDelegate.invokeTask (https://unpkg.com/[email protected]?main=browser:275:35)
at Zone.runTask (https://unpkg.com/[email protected]?main=browser:151:47)
at drainMicroTaskQueue (https://unpkg.com/[email protected]?main=browser:418:35)
at XMLHttpRequest.ZoneTask.invoke (https://unpkg.com/[email protected]?main=browser:349:25)
Error loading http://msoqa05.devlab.ad:8088/home/bl/app.module.js
Maybe I did not understand it, but in order to import angular I need to mapped it inside systemjs.config? Why?
I am trying to downgrade angular2 componenet inside app.module.ts:
import * as angular from 'angular';
import { downgradeComponent } from '@angular/upgrade/static';
angular.module('myApp')
.directive(
'helloWorld',
downgradeComponent({component: HelloWorldComponent}) as angular.IDirectiveFactory
);
The ts compile is fine with that, but the browser not ok with it and I get this error. angular.module is the basic of angularJS?
Doing so solved the problem: no need to import angular with systemjs.
import * as _angular_ from 'angular';
declare global {
const angular: typeof _angular_;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With