mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 04:14:21 +08:00
fix(angular): add injectable decorator to fix injectable issues
This commit is contained in:
@ -1,6 +1,6 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
// import { AlertController } from '@ionic/angular';
|
import { AlertController } from '@ionic/angular';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-alert-page',
|
selector: 'app-alert-page',
|
||||||
@ -21,18 +21,17 @@ import { Component } from '@angular/core';
|
|||||||
})
|
})
|
||||||
export class AlertPageComponent {
|
export class AlertPageComponent {
|
||||||
|
|
||||||
constructor(/*private alertController: AlertController*/) {
|
constructor(private alertController: AlertController) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
clickMe() {
|
clickMe() {
|
||||||
/*const alert = this.alertController.create({
|
const alert = this.alertController.create({
|
||||||
title: 'ohhhh snap',
|
title: 'ohhhh snap',
|
||||||
message: 'Gretting from an ng cli app',
|
message: 'Gretting from an ng cli app',
|
||||||
|
|
||||||
});
|
});
|
||||||
alert.present();*/
|
alert.present();
|
||||||
alert('yeah');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,8 @@ import { CommonModule } from '@angular/common';
|
|||||||
import { AlertPageComponent } from './alert-page.component';
|
import { AlertPageComponent } from './alert-page.component';
|
||||||
import { AlertRoutingModule } from './alert-routing.module';
|
import { AlertRoutingModule } from './alert-routing.module';
|
||||||
|
|
||||||
|
import { AlertController } from '@ionic/angular';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
CommonModule,
|
CommonModule,
|
||||||
|
@ -4,7 +4,7 @@ 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 { IonicAngularModule } from '@ionic/angular';
|
import { AlertController } from '@ionic/angular';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [AppComponent],
|
declarations: [AppComponent],
|
||||||
@ -13,7 +13,9 @@ import { AppRoutingModule } from './app-routing.module';
|
|||||||
BrowserModule,
|
BrowserModule,
|
||||||
// IonicAngularModule
|
// IonicAngularModule
|
||||||
],
|
],
|
||||||
providers: [],
|
providers: [
|
||||||
|
AlertController
|
||||||
|
],
|
||||||
bootstrap: [AppComponent],
|
bootstrap: [AppComponent],
|
||||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||||
})
|
})
|
||||||
|
14
packages/angular/package-lock.json
generated
14
packages/angular/package-lock.json
generated
@ -3,7 +3,6 @@
|
|||||||
"version": "0.0.2-2",
|
"version": "0.0.2-2",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"lockfileVersion": 1,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@angular/common": {
|
"@angular/common": {
|
||||||
"version": "5.0.1",
|
"version": "5.0.1",
|
||||||
@ -87,9 +86,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@stencil/core": {
|
"@stencil/core": {
|
||||||
"version": "0.0.7",
|
"version": "0.0.8-6",
|
||||||
"resolved": "https://registry.npmjs.org/@stencil/core/-/core-0.0.7.tgz",
|
"resolved": "https://registry.npmjs.org/@stencil/core/-/core-0.0.8-6.tgz",
|
||||||
"integrity": "sha512-mpS4l+aSm9i1dLFCGYXY8IDhfylh4+Aijxuzpi7G2VOmLmA/raZeS6hqtdg3pnTU72ckgdZ84D/+x4pgkluinQ==",
|
"integrity": "sha512-6lgZvuPuQbcRsqwi01Xu1HQ1XKK8dwJwO5WVcGKXVdpJ5YFvmT2W/Ocw+NwIRoJyblDlJrC1qs58yHU/Z4hgbw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"chokidar": "1.7.0",
|
"chokidar": "1.7.0",
|
||||||
@ -3252,9 +3251,10 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"typescript": {
|
"typescript": {
|
||||||
"version": "2.4.2",
|
"version": "2.5.3",
|
||||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-2.4.2.tgz",
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-2.5.3.tgz",
|
||||||
"integrity": "sha1-+DlfhdRZJ2BnyYiqQYN6j4KHCEQ="
|
"integrity": "sha512-ptLSQs2S4QuS6/OD1eAKG+S5G8QQtrU5RT32JULdZQtM1L3WTi34Wsu48Yndzi8xsObRAB9RPt/KhA9wlpEF6w==",
|
||||||
|
"dev": true
|
||||||
},
|
},
|
||||||
"uglify-es": {
|
"uglify-es": {
|
||||||
"version": "3.1.6",
|
"version": "3.1.6",
|
||||||
|
@ -42,11 +42,11 @@
|
|||||||
"@angular/platform-browser": "5.0.1",
|
"@angular/platform-browser": "5.0.1",
|
||||||
"@angular/platform-browser-dynamic": "5.0.1",
|
"@angular/platform-browser-dynamic": "5.0.1",
|
||||||
"@ionic/core": "next",
|
"@ionic/core": "next",
|
||||||
"@stencil/core": "0.0.7",
|
"@stencil/core": "next",
|
||||||
"glob": "7.1.2",
|
"glob": "7.1.2",
|
||||||
"ionicons": "~3.0.0",
|
"ionicons": "~3.0.0",
|
||||||
"rxjs": "5.5.2",
|
"rxjs": "5.5.2",
|
||||||
"typescript": "~2.4.2",
|
"typescript": "~2.5.2",
|
||||||
"zone.js": "0.8.18"
|
"zone.js": "0.8.18"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
|
import { Injectable } from '@angular/core';
|
||||||
import { AlertOptions } from '@ionic/core';
|
import { AlertOptions } from '@ionic/core';
|
||||||
|
|
||||||
import { ensureElementInBody, hydrateElement } from '../util/util';
|
import { ensureElementInBody, hydrateElement } from '../util/util';
|
||||||
|
|
||||||
let alertId = 0;
|
let alertId = 0;
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
export class AlertController {
|
export class AlertController {
|
||||||
create(opts?: AlertOptions): AlertProxy {
|
create(opts?: AlertOptions): AlertProxy {
|
||||||
return getAlertProxy(opts);
|
return getAlertProxy(opts);
|
||||||
|
@ -1,9 +1,13 @@
|
|||||||
|
import { Injectable } from '@angular/core';
|
||||||
import { NavContainer } from '@ionic/core';
|
import { NavContainer } from '@ionic/core';
|
||||||
import { hydrateElement } from '../util/util';
|
import { hydrateElement } from '../util/util';
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
export class App {
|
export class App {
|
||||||
|
|
||||||
constructor(private element: HTMLIonAppElement) {
|
private element: HTMLIonAppElement;
|
||||||
|
constructor() {
|
||||||
|
this.element = document.querySelector('ion-app') as HTMLIonAppElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
setTitle(title: string) {
|
setTitle(title: string) {
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { Injectable } from '@angular/core';
|
||||||
import { NavOptions, PublicNavController, ViewController } from '@ionic/core';
|
import { NavOptions, PublicNavController, ViewController } from '@ionic/core';
|
||||||
import { hydrateElement } from '../util/util';
|
import { hydrateElement } from '../util/util';
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user