2016-05-16 58 views
1

我正在使用tslint来检查我的angular 2项目并获取一些我不太了解的错误。下面的代码snippit得到了“期望的赋值或函数调用” - 错误,但是这不正是我的代码正在做什么?TSLint在分配变量时返回期望的赋值或函数调用

getUsers() { 
    this._userService.getUsers().subscribe(data => { 
     this.userList = data.users, 
     this.number_of_pages = data.number_of_pages, 
     this.number_of_users = data.number_of_users; 
    }); 
} 

这是一个错误还是我不正确地理解错误?我正在使用打字稿版本1.8.10。

编辑:该错误在第一次分配occures,所以this.userList = data.users

+0

哪个错误发生的确切线?谢谢! –

+0

第一次作业。 – hY8vVpf3tyR57Xib

回答

2

我认为问题是,你没有在两行的末尾使用分号,但逗号:

this.userList = data.users, // <---- 
this.number_of_pages = data.number_of_pages, // <---- 
this.number_of_users = data.number_of_users; 

您应该使用以下内容:

this.userList = data.users; // <---- 
this.number_of_pages = data.number_of_pages; // <---- 
this.number_of_users = data.number_of_users;