case-pet-detail.page.ts 672 B

1234567891011121314151617181920212223242526272829
  1. import { Component, OnInit } from '@angular/core';
  2. import { ActivatedRoute } from '@angular/router';
  3. import Parse from "parse";
  4. @Component({
  5. selector: 'app-case-pet-detail',
  6. templateUrl: './case-pet-detail.page.html',
  7. styleUrls: ['./case-pet-detail.page.scss'],
  8. })
  9. export class CasePetDetailPage implements OnInit {
  10. constructor(private route:ActivatedRoute) { }
  11. ngOnInit() {
  12. this.loadPetById()
  13. }
  14. pet:Parse.Object|undefined
  15. async loadPetById(){
  16. // let id = location.pathname.split("/").pop();
  17. let id = this.route.snapshot.params["id"]
  18. if(id){
  19. let query = new Parse.Query("Pet");
  20. this.pet = await query.get(id);
  21. }
  22. }
  23. }