首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Angular6 - 'json‘在类型'Object’上不存在

Angular6 - 'json‘在类型'Object’上不存在
EN

Stack Overflow用户
提问于 2018-08-02 09:21:13
回答 1查看 2.2K关注 0票数 1

在Angular 6中,我得到了下面的错误信息

代码语言:javascript
复制
public getList() {
        return this.http.get(environment.serverUrl +'/vmsdata/v1/tftoport/customer/1001')
            .toPromise()
            .then(response => response.json()
            .then(json => {
                console.log('data', json.items);
                return json.items;
            });
    }

对于行.then(response => response.json(),错误是[ts] Property 'json' does not exist on type 'Object'

对于行,.then(json => {错误为[ts] Parameter 'json' implicitly has an 'any' type.

EN

回答 1

Stack Overflow用户

发布于 2018-08-02 13:28:00

在Angular 6中,您不需要将数据映射到json,因为angular 6默认提供了json。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/51644258

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档