[SOLVED] Ionic 3 and Angular 4 - Uncaught (in promise): TypeError: Cannot read property ‘set’ of undefined


#1

Eu sou realmente novo em Angular e Ionic.
Estou seguindo um tutorial que encontrei em linha para criar um pequeno aplicativo para treinamento e propósito de teste. Estou usando Angular 4 e Ionic 3.
Por favor, alguém sabe por que está recebendo os erros abaixo? Eu também acompanho outro tutorial e estou recebendo o mesmo tipo de erro. Alguém, por favor, me ajude.

Runtime Error
Cannot read property ‘set’ of undefined
Stack
TypeError: Cannot read property ‘set’ of undefined
at isFirebaseRef (http://localhost:8100/build/vendor.js:42006:25)
at checkOperationCases (http://localhost:8100/build/vendor.js:42016:14)
at Object.dataOperation [as update] (http://localhost:8100/build/vendor.js:130664:91)
at VagaListService.webpackJsonp.77.VagaListService.editVaga (http://localhost:8100/build/main.js:389:33)
at EditarPage.webpackJsonp.429.EditarPage.saveVaga (http://localhost:8100/build/0.js:76:19)
at Object.eval [as handleEvent] (ng:///EditarPageModule/EditarPage.ngfactory.js:90:27)
at handleEvent (http://localhost:8100/build/vendor.js:12380:138)
at callWithDebugContext (http://localhost:8100/build/vendor.js:13850:42)
at Object.debugHandleEvent [as handleEvent] (http://localhost:8100/build/vendor.js:13438:12)
at dispatchEvent (http://localhost:8100/build/vendor.js:8972:21)
Ionic Framework: 3.8.0
Ionic App Scripts: 3.0.1
Angular Core: 4.4.4
Angular Compiler CLI: 4.4.4
Node: 6.11.2
OS Platform: Windows 10
Navigator Platform: Win32
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36

Pilha de erro console

ng:///EditarPageModule/EditarPage.ngfactory.js:85 ERROR TypeError: Cannot read property ‘set’ of undefined
at isFirebaseRef (vendor.js:42006)
at checkOperationCases (vendor.js:42016)
at Object.dataOperation [as update] (vendor.js:130664)
at VagaListService.webpackJsonp.77.VagaListService.editVaga (main.js:389)
at EditarPage.webpackJsonp.429.EditarPage.saveVaga (:8100/build/0.js:76)
at Object.eval [as handleEvent] (ng:///EditarPageModule/EditarPage.ngfactory.js:90)
at handleEvent (vendor.js:12380)
at callWithDebugContext (vendor.js:13850)
at Object.debugHandleEvent [as handleEvent] (vendor.js:13438)
at dispatchEvent (vendor.js:8972)
View_EditarPage_0 @ ng:///EditarPageModule/EditarPage.ngfactory.js:85
ng:///EditarPageModule/EditarPage.ngfactory.js:85
ERROR CONTEXT DebugContext_

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 { LoginPage } from ‘…/pages/login/login’;

@Component({
templateUrl: ‘app.html’
})
export class MyApp {

rootPage:any = LoginPage;

constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen) {
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();
});
}
}

Minha page edita.tsr (Com erros)

import { Component } from ‘@angular/core’;
import { IonicPage, NavController, NavParams } from ‘ionic-angular’;
import { Vaga } from ‘./…/…/modelo/vaga/vaga.model’;
import { VagaListService } from ‘./…/…/service/vaga-list/vaga-list-service’;
import { HomePage } from ‘…/home/home’;

@IonicPage()
@Component({
selector: ‘page-editar’,
templateUrl: ‘editar.html’,
})
export class EditarPage {

item: Vaga;

constructor(public navCtrl: NavController, public navParams: NavParams, private vaga: VagaListService) {
}

ionViewWillLoad() {

this.item = this.navParams.get(‘item’);

}

saveVaga(vaga: Vaga){

this.vaga.editVaga(vaga)
.then(() =>{
this.navCtrl.setRoot(HomePage);
});

}

}

Minha page editar.html

{{item?.nome}} Nome da Escola * Quantidade *

<button ion-button block clear (click)=“saveVaga(vaga)” >Salvar

Minha page de serviço

import { Component } from ‘@angular/core’;
import { IonicPage, NavController, NavParams } from ‘ionic-angular’;
import { Vaga } from ‘./…/…/modelo/vaga/vaga.model’;
import { VagaListService } from ‘./…/…/service/vaga-list/vaga-list-service’;
import { HomePage } from ‘…/home/home’;

@IonicPage()
@Component({
selector: ‘page-editar’,
templateUrl: ‘editar.html’,
})
export class EditarPage {

item: Vaga;

constructor(public navCtrl: NavController, public navParams: NavParams, private vaga: VagaListService) {
}

ionViewWillLoad() {

this.item = this.navParams.get(‘item’);

}

saveVaga(vaga: Vaga){

this.vaga.editVaga(vaga)
.then(() =>{
this.navCtrl.setRoot(HomePage);
});

}

}

Helpe-me please?