У меня проблема с одной из моих страниц.Когда я нажимаю, чтобы открыть, появляется ошибка
«Нет поставщика для Sugerir» на странице «novolocal.ts».Все приложение открыто и работает нормально, в том числе "Sugerir.ts".
Мой novolocal.ts
import { NavController } from 'ionic-angular';
import { Component, NgZone, ElementRef, OnInit, ViewChild } from '@angular/core';
import { MapProxPage } from '../Map-prox/Map-prox';
import { ProjetoTCCBrendaPage } from '../projeto-tccbrenda/projeto-tccbrenda';
import { listaProxPage } from '../lista-prox/lista-prox';
import { CadastroPage } from '../cadastro/cadastro';
import { myService } from '../services/data.service';
@Component({
selector: 'page-novolocal',
templateUrl: 'novolocal.html'
})
export class NovolocalPage {
public event = {
month: '10-05-2018',
timeStarts: '09:00',
timeEnds: '10-05-2018'
}
constructor(public navCtrl: NavController,private _myService: myService) {
console.log(this._myService.getData());
}
goToMapProxPage(params){
if (!params) params = {};
this.navCtrl.push(MapProxPage);
}goToProjetoTCCBrenda(params){
if (!params) params = {};
this.navCtrl.push(ProjetoTCCBrendaPage);
}goTolistaProx(params){
if (!params) params = {};
this.navCtrl.push(listaProxPage);
}goToCadastro(params){
if (!params) params = {};
this.navCtrl.push(CadastroPage);
}goToNovolocal(params){
if (!params) params = {};
this.navCtrl.push(NovolocalPage);
}
}
Мой app.module.ts
import { NgModule, ErrorHandler, Component } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { IonicApp, IonicModule, IonicErrorHandler } from 'ionic-angular';
import { MyApp } from './app.component';
import { ProjetoTCCBrendaPage } from '../pages/projeto-tccbrenda/projeto-tccbrenda';
import { listaProxPage } from '../pages/lista-prox/lista-prox';
import { CadastroPage } from '../pages/cadastro/cadastro';
import { NovolocalPage } from '../pages/novolocal/novolocal';
import { MapProxPage } from '../pages/Map-prox/Map-prox';
import { SugerirPage } from '../pages/sugerir/sugerir';
import { Geolocation } from '@ionic-native/geolocation';
import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';
import { HttpModule } from '@angular/http';
import { AgmCoreModule } from '@agm/core';
import { myService } from '../pages/services/data.service';
import {
AngularFireDatabaseModule,
} from "angularfire2/database";
import {
AngularFireDatabase,
FirebaseObjectObservable,
FirebaseListObservable
} from 'angularfire2/database-deprecated';
import { AngularFireAuthModule, AngularFireAuth } from 'angularfire2/auth';
import { AngularFireModule } from 'angularfire2';
import { SugestoesPage } from '../pages/sugestoes/sugestoes';
import { Device } from '@ionic-native/device';
import { GoogleMaps } from '@ionic-native/google-maps';
import * as firebase from 'firebase';
import { HomePage } from '../pages/home/home';
var config = {
apiKey: "hereismyapikey",
authDomain: "geoloc-121315.firebaseapp.com",
databaseURL: "https://geoloc-121315.firebaseio.com",
projectId: "geoloc-121315",
storageBucket: "geoloc-179420.appspot.com",
messagingSenderId: "mymsgid"
};
firebase.initializeApp(config);
@NgModule({
declarations: [
MyApp,
ProjetoTCCBrendaPage,
listaProxPage,
MapProxPage,
CadastroPage,
NovolocalPage,
SugestoesPage,
HomePage,
SugerirPage
],
imports: [
BrowserModule,
IonicModule.forRoot(MyApp),
HttpModule,
AngularFireModule.initializeApp(config),
AngularFireDatabaseModule,
AngularFireAuthModule,
AgmCoreModule.forRoot({
apiKey: "AIzaSyDvXaxJqvlH_84DrxytYNF341Ax67H1OU8",
libraries: ["places"]
})
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
ProjetoTCCBrendaPage,
listaProxPage,
CadastroPage,
NovolocalPage,
MapProxPage,
SugerirPage,
SugestoesPage,
HomePage
],
providers: [
GoogleMaps,
AngularFireDatabase,
StatusBar,
SplashScreen,
{ provide: ErrorHandler, useClass: IonicErrorHandler },
Geolocation, //provider p geoloc nativo
myService,
Device
]
})
export class AppModule {
}
Мой Sugerir.ts
import { Component, Inject } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import { MapProxPage } from '../Map-prox/Map-prox';
import { ProjetoTCCBrendaPage } from '../projeto-tccbrenda/projeto-tccbrenda';
import { listaProxPage } from '../lista-prox/lista-prox';
import { CadastroPage } from '../cadastro/cadastro';
import { NovolocalPage } from '../novolocal/novolocal';
import { SugestoesPage } from '../sugestoes/sugestoes';
import { AngularFireList } from 'angularfire2/database';
import {
AngularFireDatabase,
FirebaseObjectObservable,
FirebaseListObservable
} from 'angularfire2/database-deprecated';
export class Sugerir {//para cadastrar
id: string;
cidade: string;
melhordia: string;
melhorhora: string;
pub: string;
tipo: string;
uf: string;
valor: string;
}
@IonicPage()
@Component({
selector: 'page-sugerir',
templateUrl: 'sugerir.html',
})
export class SugerirPage {
sugerir: Sugerir; //para cadastrar
sugestoes: FirebaseListObservable<any[]>;//para exibir e cadastrar
constructor(public db: AngularFireDatabase, public navCtrl: NavController) {
this.sugestoes = this.db.list('/sugestoes');//para exibir e cadastrar
this.sugerir = new Sugerir();//para cadastrar
}
cadastrar() {//para cadastrar
this.sugestoes.push(this.sugerir).then(() => {
this.sugerir = new Sugerir();
});
alert("Salvo!");
}
goToMapProxPage(params) {
if (!params) params = {};
this.navCtrl.push(MapProxPage);
} goToProjetoTCCBrenda(params) {
if (!params) params = {};
this.navCtrl.push(ProjetoTCCBrendaPage);
} goTolistaProx(params) {
if (!params) params = {};
this.navCtrl.push(listaProxPage);
} goToCadastro(params) {
if (!params) params = {};
this.navCtrl.push(CadastroPage);
} goToSugerir(params) {
if (!params) params = {};
this.navCtrl.push(SugerirPage);
} goToSugestoes(params) {
if (!params) params = {};
this.navCtrl.push(SugestoesPage);
}
}
Я действительно не понимаюсвязь между "novolocal.ts" и "sugerir.ts", которая может вызвать эту ошибку.