"@angular/platform-browser": "^5.0.0",
"@angular/platform-browser-dynamic": "^5.0.0",
"@angular/router": "^5.0.0",
+ "@angular/upgrade": "^5.2.6",
"@ng-bootstrap/ng-bootstrap": "^1.0.0-beta.5",
"core-js": "^2.4.1",
"jquery": "^3.2.1",
import {NgbModule} from '@ng-bootstrap/ng-bootstrap'; // ng-bootstrap
import {CookieModule} from 'ngx-cookie'; // import CookieMonster
+// XXX required for multi-mode
+import {UpgradeModule} from '@angular/upgrade/static';
+import {Router} from '@angular/router';
+
import {EgBaseComponent} from './app.component';
import {EgBaseRoutingModule} from './routing.module';
import {WelcomeComponent} from './welcome.component';
import {EgPcrudService} from '@eg/core/pcrud';
import {EgOrgService} from '@eg/core/org';
+// TODO: add environment controls for enabling multi-mode?
+// XXX required for multi-mode
+declare var angular: any;
+
+
@NgModule({
declarations: [
EgBaseComponent,
WelcomeComponent
],
imports: [
+ UpgradeModule, // XXX multi-mode
EgBaseRoutingModule,
BrowserModule,
NgbModule.forRoot(),
EgOrgService
],
exports: [],
- bootstrap: [EgBaseComponent]
+ //bootstrap: [EgBaseComponent] // XXX multi-mode
})
-export class EgBaseModule {}
+export class EgBaseModule {
+
+ // XXX whole class def required for multi-mode only
+
+ constructor(
+ private upgrade: UpgradeModule,
+ private router: Router
+ ) {}
+
+ ngDoBootstrap() {
+ console.log('ngDoBootstrap()');
+
+ let myWin: any = window;
+
+ if (!myWin.ang1PageApp) {
+ console.error('NO PAGE APP DEFINED');
+ return;
+ }
+
+ /*
+ angular.module(myWin.ang1PageApp).directive('heroDetail',
+ downgradeComponent({ component: HeroDetailComponent })
+ );
+ */
+
+ // some of our ang1 apps are not strict-di compliant :(
+ this.upgrade.bootstrap(document.body, [myWin.ang1PageApp]);
+ //this.upgrade.bootstrap(document.body, [myWin.ang1PageApp], { strictDi: true });
+ }
+
+}
<!doctype html>
[%- PROCESS 'staff/config.tt2' %]
<html lang="[% ctx.locale %]"
- [%- IF ctx.page_app %] ng-app="[% ctx.page_app %]"[% END -%]
+ [%- IF ctx.page_app %] xng-app="[% ctx.page_app %]"[% END -%]
[%- IF ctx.page_ctrl %] ng-controller="[% ctx.page_ctrl %]"[% END %]>
<head>
+ <script>
+ [%- IF ctx.page_app %]
+ // tell ang2 what ang1 wants to load.
+ window.ang1PageApp = "[% ctx.page_app %]";
+ [% END -%]
+ </script>
<!-- enables ng-cloak to be usable before angular has been able to fully load -->
<style type="text/css">
[ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak {
# App-specific JS load commands go into an APP_JS block.
PROCESS APP_JS;
+
+ # Angular2 scripts must be imported after app-specific ang1 imports
+ INCLUDE "staff/ang2_js.tt2";
%]
<!-- content printed via the browser is inserted here for