首页 > 解决方案 > 无法解析服务参数

问题描述

我在 app.module 提供程序中引用了一项服务,该服务引发了以下错误。该服务未在我的代码中使用(我将其删除以进行错误检查)。如果我删除我的提供者中的引用,我的代码就可以工作。服务有什么问题?

Uncaught Error: Can't resolve all parameters for UserService: (?).

import { ArgosUserModel } from '../argos.user.model';
import { Observable } from 'rxjs';
import { HttpClient } from '@angular/common/http';

export class UserService {
    constructor(private http: HttpClient) { }

    getUsers(): Observable<ArgosUserModel[]> {
        return this.http.get<ArgosUserModel[]>('/api/argos/GetArgosUsers');
    }
}

标签: angularservice

解决方案


推荐阅读