ts 3.0.1的subscribe()上预期的声明或声明

时间:2018-08-13 08:16:08

标签: angular typescript subscription

我正在得到声明或声明。我最近更新了ts和angular。

getTopics() {
    this._dataService.getTopics().subscribe(res => {
        this.topics = res;

        for (let i = 0; i < this.topics.length; i++) {
            if (this.topics[i]._id > this.max) {
                (this.max = this.topics[i]._id);
            }
    });
}

1 个答案:

答案 0 :(得分:0)

我的坏。我错过了一个}。但它在以前的版本中可用。

getTopics() {
this._dataService.getTopics().subscribe(res => {
    this.topics = res;

    for (let i = 0; i < this.topics.length; i++) {
        if (this.topics[i]._id > this.max) {
            (this.max = this.topics[i]._id);
        }
    }
});
}
相关问题