Search code examples
angularangular2-routingangular2-templateangular2-servicesangular2-directives

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


Solution

  • Write following lines of code out of selector

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