Created
August 7, 2018 15:07
-
-
Save NandoKstroNet/5a92a3b5a5567031aa684839d30da022 to your computer and use it in GitHub Desktop.
Ionic page para uso em nosso projeto Ionic com Firebase do site ionichero.com
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { HomePage } from './../home/home'; | |
import { FirebaseServiceProvider } from './../../providers/firebase-service/firebase-service'; | |
import { Component } from '@angular/core'; | |
import { IonicPage, NavController, NavParams } from 'ionic-angular'; | |
import { ToastrServiceProvider } from '../../providers/toastr-service/toastr-service'; | |
/** | |
* Generated class for the EditPage page. | |
* | |
* See https://ionicframework.com/docs/components/#navigation for more info on | |
* Ionic pages and navigation. | |
*/ | |
@IonicPage() | |
@Component({ | |
selector: 'page-edit', | |
templateUrl: 'edit.html', | |
}) | |
export class EditPage { | |
course = { | |
'title': '', | |
'price': '', | |
'description': '' | |
}; | |
constructor( | |
public navCtrl: NavController, | |
public navParams: NavParams, | |
public firebaseService: FirebaseServiceProvider, | |
public toastrService: ToastrServiceProvider | |
) { | |
this.course = this.navParams.get('course'); | |
} | |
update(course) { | |
this.firebaseService.update(course).then(d => { | |
this.toastrService.show('Curso atualizado com sucesso!', 3000) | |
.present(); | |
this.navCtrl.setRoot(HomePage); | |
}); | |
} | |
remove(course) { | |
this.firebaseService.remove(course).then(d => { | |
this.toastrService.show('Curso removido com sucesso!', 3000) | |
.present(); | |
this.navCtrl.setRoot(HomePage); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment