Cannot find a differ supporting object '[object Object]' of type 'object'. NgFor only supports binding to Iterables such as Arrays.
using router


services
- getdetails(id:number){
- this.http.get('http://localhost:1858/api/details/' + id).map((data: Response) =>{
- return data.json() as INewsModule[];
- }).toPromise().then(x=>{
- this._detailsNews = x;
- });
- }
- import { Component, OnInit } from '@angular/core';
- import { NewsService } from '../../../serv/news.service';
- import { ActivatedRoute } from '@angular/router';
- @Component({
- selector: 'app-details',
- templateUrl: './details.component.html',
- styleUrls: ['./details.component.scss'],
- providers:[NewsService]
- })
- export class DetailsComponent implements OnInit {
- constructor(private _NewsService : NewsService,
- private _activeRoute: ActivatedRoute) { }
- ngOnInit() {
- let id : number = this._activeRoute.snapshot.params['id'];
- this._NewsService.getdetails(id);
- }
- }
template
- <table class="table">
- <caption>List of userscaption>
- <thead>
- <tr>
- <th scope="col">#th>
- <th scope="col">NameNewsth>
- tr>
- thead>
- <tbody>
- <tr *ngFor="let details of _NewsService._detailsNews">
- <th scope="col"> {{details.NameNews}}th>
- {{details.TopicNews}}
- {{details.DateNews}}
- tr>
- tbody>
- table>

bishoe nbPosted May 9, 2019, 6:07 AM
Laxmidhar Sahoo
bishoe nbPosted May 9, 2019, 6:05 AM
Laxmidhar SahooPosted May 9, 2019, 12:21 AM
Mandar ShindePosted May 8, 2019, 11:38 PM
bishoe nbPosted May 8, 2019, 7:56 AM
Mandar ShindePosted May 8, 2019, 5:22 AM
bishoe nbPosted May 7, 2019, 12:28 AM
Manoj BhoirPosted May 6, 2019, 2:42 AM