MOBILE-2163 aot: Support site plugins in AOT
parent
f3d103f311
commit
804e8c7b02
File diff suppressed because it is too large
Load Diff
|
@ -14,11 +14,12 @@
|
|||
|
||||
import { BrowserModule } from '@angular/platform-browser';
|
||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { NgModule, COMPILER_OPTIONS } from '@angular/core';
|
||||
import { IonicApp, IonicModule, Platform, Content, ScrollEvent } from 'ionic-angular';
|
||||
import { assert } from 'ionic-angular/util/util';
|
||||
import { HttpModule } from '@angular/http';
|
||||
import { HttpClient, HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
|
||||
import { JitCompilerFactory } from '@angular/platform-browser-dynamic';
|
||||
|
||||
import { TranslateModule, TranslateLoader } from '@ngx-translate/core';
|
||||
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
|
||||
|
@ -248,7 +249,9 @@ export const CORE_PROVIDERS: any[] = [
|
|||
provide: HTTP_INTERCEPTORS,
|
||||
useClass: CoreInterceptor,
|
||||
multi: true,
|
||||
}
|
||||
},
|
||||
{provide: COMPILER_OPTIONS, useValue: {}, multi: true},
|
||||
{provide: JitCompilerFactory, useClass: JitCompilerFactory, deps: [COMPILER_OPTIONS]}
|
||||
]
|
||||
})
|
||||
export class AppModule {
|
||||
|
|
|
@ -15,13 +15,15 @@
|
|||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { CoreCompileHtmlComponent } from './compile-html';
|
||||
import { CoreComponentsModule } from '@components/components.module';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
CoreCompileHtmlComponent
|
||||
],
|
||||
imports: [
|
||||
CommonModule
|
||||
CommonModule,
|
||||
CoreComponentsModule
|
||||
],
|
||||
exports: [
|
||||
CoreCompileHtmlComponent
|
||||
|
|
|
@ -37,7 +37,7 @@ import { CoreDomUtilsProvider } from '@providers/utils/dom';
|
|||
*/
|
||||
@Component({
|
||||
selector: 'core-compile-html',
|
||||
template: '<ng-container #dynamicComponent></ng-container>'
|
||||
template: '<core-loading [hideUntil]="loaded"><ng-container #dynamicComponent></ng-container></core-loading>'
|
||||
})
|
||||
export class CoreCompileHtmlComponent implements OnChanges, OnDestroy, DoCheck {
|
||||
@Input() text: string; // The HTML text to display.
|
||||
|
@ -50,6 +50,8 @@ export class CoreCompileHtmlComponent implements OnChanges, OnDestroy, DoCheck {
|
|||
// Get the container where to put the content.
|
||||
@ViewChild('dynamicComponent', { read: ViewContainerRef }) container: ViewContainerRef;
|
||||
|
||||
loaded: boolean;
|
||||
|
||||
protected componentRef: ComponentRef<any>;
|
||||
protected componentInstance: any;
|
||||
protected element;
|
||||
|
@ -93,6 +95,8 @@ export class CoreCompileHtmlComponent implements OnChanges, OnDestroy, DoCheck {
|
|||
this.componentRef = this.container.createComponent(factory);
|
||||
this.created.emit(this.componentRef.instance);
|
||||
}
|
||||
|
||||
this.loaded = true;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
// limitations under the License.
|
||||
|
||||
import { Injectable, Injector, Component, NgModule, Compiler, ComponentFactory, ComponentRef, NgModuleRef } from '@angular/core';
|
||||
import { JitCompilerFactory } from '@angular/platform-browser-dynamic';
|
||||
import {
|
||||
Platform, ActionSheetController, AlertController, LoadingController, ModalController, PopoverController, ToastController,
|
||||
IonicModule
|
||||
|
@ -125,6 +126,7 @@ import { AddonNotificationsComponentsModule } from '@addon/notifications/compone
|
|||
export class CoreCompileProvider {
|
||||
|
||||
protected logger;
|
||||
protected compiler: Compiler;
|
||||
|
||||
// Other Ionic/Angular providers that don't depend on where they are injected.
|
||||
protected OTHER_PROVIDERS = [
|
||||
|
@ -141,8 +143,10 @@ export class CoreCompileProvider {
|
|||
AddonNotificationsComponentsModule
|
||||
];
|
||||
|
||||
constructor(protected injector: Injector, logger: CoreLoggerProvider, protected compiler: Compiler) {
|
||||
constructor(protected injector: Injector, logger: CoreLoggerProvider, compilerFactory: JitCompilerFactory) {
|
||||
this.logger = logger.getInstance('CoreCompileProvider');
|
||||
|
||||
this.compiler = compilerFactory.createCompiler();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue