JavaEar 专注于收集分享传播有价值的技术资料

Angular 2 :Uncaught (in promise): RangeError: Maximum call stack size exceeded RangeError: Maximum call stack size exceeded

I just begin working with angular 2. so I try to display categories from data base using web service.

this is my forum.service.ts file

   public getCategories(){
        return this.http.get('http://localhost/ForumLaraAngular/public/api/forum').map((res: Response) => res.json());

     }

forum.component.ts:

categories:any;

  constructor(private forumService:ForumService) { }

  ngOnInit(): void {

    this.forumService.getCategories().subscribe((data)=>{this.categories=data;})

}

forum.component.html:

<categories>
<ul>
<li *ngFor="let categ of categories"> {{categ.titre}}</li>
</ul>

</categories>

Any help please,thanks in advance

1个回答

    最佳答案
  1. Write following lines of code out of selector

    <ul>
    <li *ngFor="let categ of categories"> {{categ.titre}}</li>
    </ul>