我正在尝试在组件中实例化服务。我收到这个错误
未捕获的错误:无法解析 AuthenticationService 的所有参数:(?, [object Object], ?)。
这是我的服务
@Injectable()
export class AuthenticationService {
protected basePath = 'http://localhost:8080/rest';
public defaultHeaders: Headers = new Headers();
public configuration: Configuration = new Configuration();
constructor(protected http: Http, @Optional() @Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
if (basePath) {
this.basePath = basePath;
}
if (configuration) {
this.configuration = configuration;
this.basePath = basePath || configuration.basePath || this.basePath;
}
}
public login(authenticationkey?: string, body?: AuthenticationRequestHolder, extraHttpRequestParams?: any): Observable<AuthenticationBundle> {
return this.loginWithHttpInfo(authenticationkey, body, extraHttpRequestParams)
.map((response: Response) => {
if …Run Code Online (Sandbox Code Playgroud) 关于"编译与解释"有很多答案和引文,我确实理解它们之间的差异.
说到C,我不确定.C是编译还是解释或两者兼而有之?如果你加上一些解释,我真的很感激.