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