Привет, поскольку заголовок подсказывает, что моя проблема довольно проста, после того, как я попытался импортировать Push-уведомления, мой '@Component ({})' начал выдавать мне ошибки, когда я наводил курсор на свой инжектированный конструктор, куда я вставил свой push-импорт я получаю следующую ошибку "не могу использовать пространство имен 'Push' как тип."
Вот принтскрин: https://imgur.com/a/SXIrXjf
И еще: https://imgur.com/a/gTNRDdL
И, наконец, вот мой код:
app.component.ts
import { Component } from '@angular/core';
import { Platform } from 'ionic-angular';
import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';
import { Push, PushObject, PushOptions } from '@ionic-native/push';
import { HomePage } from '../pages/home/home';
@Component({
templateUrl: 'app.html'
})
export class MyApp {
rootPage:any = HomePage;
constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen, private push: Push) {
platform.ready().then(() => {
// Okay, so the platform is ready and our plugins are available.
// Here you can do any higher level native things you might need.
statusBar.styleDefault();
splashScreen.hide();
this.pushSetup();
});
}
pushSetup(){
const options: PushOptions = {
android: {
senderID: '781594090050'
},
ios: {
alert: 'true',
badge: true,
sound: 'false'
}
};
const pushObject: PushObject = this.push.init(options);
pushObject.on('notification').subscribe((notification: any) => console.log('Received a notification', notification));
pushObject.on('registration').subscribe((registration: any) => console.log('Device registered', registration));
pushObject.on('error').subscribe(error => console.error('Error with Push plugin', error));
}
}
app.module.ts
import { BrowserModule } from '@angular/platform-browser';
import { ErrorHandler, NgModule } from '@angular/core';
import { IonicApp, IonicErrorHandler, IonicModule } from 'ionic-angular';
import { SplashScreen } from '@ionic-native/splash-screen';
import { StatusBar } from '@ionic-native/status-bar';
import { MyApp } from './app.component';
import { HomePage } from '../pages/home/home';
import { Push } from '@ionic-native/push';
@NgModule({
declarations: [
MyApp,
HomePage
],
imports: [
BrowserModule,
IonicModule.forRoot(MyApp)
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
HomePage
],
providers: [
StatusBar,
SplashScreen,
Push,
{provide: ErrorHandler, useClass: IonicErrorHandler}
]
})
export class AppModule {}
Как мне это исправить? пожалуйста помогите