Created
October 16, 2019 07:30
-
-
Save mphuget/e6ae7ee7770727245bc36d07d03eb6bf to your computer and use it in GitHub Desktop.
view.page.ts
This file contains 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 { Component, OnInit } from '@angular/core'; | |
import { LoadingController } from '@ionic/angular'; | |
import { RestService } from '../rest.service'; | |
import { ActivatedRoute, ParamMap } from '@angular/router'; | |
@Component({ | |
selector: 'app-view', | |
templateUrl: './view.page.html', | |
styleUrls: ['./view.page.scss'], | |
}) | |
export class ViewPage implements OnInit { | |
todo : any; | |
api : RestService; | |
id : string; | |
constructor(public restapi: RestService, public loadingController: LoadingController, private route: ActivatedRoute) { | |
this.api = restapi; | |
} | |
async getTodo(id:any) { | |
const loading = await this.loadingController.create({ | |
message: 'Loading' | |
}); | |
this.todo = {"title": "Do the laundry", "description" : "Laundry"}; | |
} | |
save() { | |
} | |
delete() { | |
} | |
ngOnInit() { | |
this.route.paramMap.subscribe((params : ParamMap)=> { | |
this.id=params.get('id'); | |
}); | |
console.log("Current id: " + this.id); | |
this.getTodo(this.id); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment