Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/29.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular ts 3.0.1的subscribe()上需要声明或语句_Angular_Typescript_Subscription - Fatal编程技术网

Angular ts 3.0.1的subscribe()上需要声明或语句

Angular ts 3.0.1的subscribe()上需要声明或语句,angular,typescript,subscription,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) {

我收到预期的声明或声明。我最近更新了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);
            }
    });
}
getTopics(){
这是._dataService.getTopics().subscribe(res=>{
this.topics=res;
for(设i=0;ithis.max){
(this.max=this.topics[i]。\u id);
}
});
}

我的错。我错过了一个}。但它在以前的版本中工作

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);
        }
    }
});
}
getTopics(){
这是._dataService.getTopics().subscribe(res=>{
this.topics=res;
for(设i=0;ithis.max){
(this.max=this.topics[i]。\u id);
}
}
});
}