TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
bishoe nb
NA
623
80.3k
Cannot find a differ supporting object ‘[object Object]’ of
May 6 2019 1:29 AM
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;
});
}
component
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 users
</
caption
>
<
thead
>
<
tr
>
<
th
scope
=
"col"
>
#
</
th
>
<
th
scope
=
"col"
>
NameNews
</
th
>
</
tr
>
</
thead
>
<
tbody
>
<
tr
*
ngFor
=
"let details of _NewsService._detailsNews"
>
<
th
scope
=
"col"
>
{{details.NameNews}}
</
th
>
{{details.TopicNews}}
{{details.DateNews}}
</
tr
>
</
tbody
>
</
table
>
Reply
Answers (
8
)
Regarding Library
Regarding Calling Multiple time a single popup.