Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 48980

How can i show json http details page in ionic5

$
0
0

Please I have problem when i print data in details page My code I Dont Want Use Services

    **Schools Page**   

 items: Observable<any>;
constructor(private router: Router, private http: HttpClient) {}
ngOnInit() {
this.items = this.http.get('assets/data/schools.json');
this.items.subscribe(data => {
});
}

onselect(item){
this.router.navigate(['/education/schools', item.id])
}

 <ion-content>
  <ion-list >
  <ion-item button detail lines="inset" *ngFor="let item of (items | async)?.schools" 
   (click)="onselect(item)" >
  {{ item.name }}
  </ion-item>
   </ion-list>
  </ion-content>

  **Details Page**

   public itemId;
  constructor(private route: ActivatedRoute, private router : Router) {}

  ngOnInit(){
   this.route.paramMap.subscribe((params: ParamMap) =>{
   let id = parseInt(params.get('id'));
   this.itemId = id;
  });
  }

  <ion-card >
  <ion-card-content>
   My Name {{item.name}}
  </ion-card-content>
  </ion-card>

i want to show {{item.name}} and others

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 48980

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>