0
我是新來的離子,我想我的側邊欄有一個用戶配置文件的標題,他/她的詳細信息顯示爲其他類似的應用程序取決於誰登錄的應用程序。但是我在下面遇到這個錯誤。運行時錯誤無法解析用戶服務的所有參數:(?)
運行時錯誤無法解析UserService的所有參數:(?)。
這裏是我下面的代碼:
import { Injectable } from '@angular/core';
// import { Global } from '../../providers/global';
@Injectable()
export class UserService {
constructor(public storage: Storage
)
{
}
user: any;
token_type: any;
access_token: any;
refresh_token:any;
getAccount(): any{
return this.storage.get('user').then((value) => {
return value;
});
}
}
環境的詳細信息:
cli packages: (/usr/lib/node_modules)
@ionic/cli-utils : 1.9.2
ionic (Ionic CLI) : 3.9.2
global packages:
Cordova CLI : 7.0.1
local packages:
@ionic/app-scripts : 2.0.2
Cordova Platforms : none
Ionic Framework : ionic-angular 3.5.3
System:
Node : v6.11.1
npm : 3.10.10
OS : Linux 4.10
尋找幫助。提前致謝。
您是否在'AppModule' /'Component'的'providers'數組中添加了'UserService'? –
是的,我添加了它。但仍然無法工作。 –
不是'UserService','Storage'(它是'UserService'中的一個參數)是罪魁禍首。 –