mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-16 10:01:59 +08:00
feat(module): add a forRoot to the @ionic/angular module
This commit is contained in:
@ -1,4 +1,8 @@
|
|||||||
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
import {
|
||||||
|
ModuleWithProviders,
|
||||||
|
NgModule,
|
||||||
|
CUSTOM_ELEMENTS_SCHEMA
|
||||||
|
} from '@angular/core';
|
||||||
|
|
||||||
import { BooleanValueAccessor } from './control-value-accessors/boolean-value-accessor';
|
import { BooleanValueAccessor } from './control-value-accessors/boolean-value-accessor';
|
||||||
import { RadioValueAccessor } from './control-value-accessors/radio-value-accessor';
|
import { RadioValueAccessor } from './control-value-accessors/radio-value-accessor';
|
||||||
@ -26,9 +30,15 @@ import { AlertController } from './providers/alert-controller';
|
|||||||
],
|
],
|
||||||
schemas: [
|
schemas: [
|
||||||
CUSTOM_ELEMENTS_SCHEMA
|
CUSTOM_ELEMENTS_SCHEMA
|
||||||
],
|
]
|
||||||
|
})
|
||||||
|
export class IonicAngularModule {
|
||||||
|
static forRoot(): ModuleWithProviders {
|
||||||
|
return {
|
||||||
|
ngModule: IonicAngularModule,
|
||||||
providers: [
|
providers: [
|
||||||
AlertController
|
AlertController
|
||||||
]
|
]
|
||||||
})
|
};
|
||||||
export class IonicAngularModule { }
|
}
|
||||||
|
}
|
||||||
|
@ -4,16 +4,15 @@ import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
|
|||||||
import { AppComponent } from './app.component';
|
import { AppComponent } from './app.component';
|
||||||
import { AppRoutingModule } from './app-routing.module';
|
import { AppRoutingModule } from './app-routing.module';
|
||||||
|
|
||||||
import { AlertController } from '@ionic/angular';
|
import { IonicAngularModule } from '@ionic/angular';
|
||||||
|
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [AppComponent],
|
declarations: [AppComponent],
|
||||||
imports: [
|
imports: [
|
||||||
AppRoutingModule,
|
AppRoutingModule,
|
||||||
BrowserModule,
|
BrowserModule,
|
||||||
],
|
IonicAngularModule.forRoot()
|
||||||
providers: [
|
|
||||||
AlertController
|
|
||||||
],
|
],
|
||||||
bootstrap: [AppComponent],
|
bootstrap: [AppComponent],
|
||||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||||
|
Reference in New Issue
Block a user