首页 文章

Angular 2:Uncaught(承诺):RangeError:超出最大调用堆栈大小RangeError:超出最大调用堆栈大小

提问于
浏览
0

我刚开始使用angular 2.所以我尝试使用Web服务从数据库中显示类别 .

这是我的forum.service.ts文件

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>

请提前帮助,谢谢

1 回答

  • -1

    从选择器中写出以下代码行

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

相关问题