Validation 没有Http的提供程序!(SomeService->;Http)

Validation 没有Http的提供程序!(SomeService->;Http),validation,angular,angular2-forms,angular2-services,custom-validators,Validation,Angular,Angular2 Forms,Angular2 Services,Custom Validators,我正在尝试为Angular 2表单控件创建自定义异步验证程序。我有一个类,它有一个静态方法来检查服务器上用户的唯一性。我创建了一个服务(UsersService),并在其构造函数中注入了Http服务。我正在尝试在验证器中使用此服务(UsersService)。我正在使用ReflectiveInjector.resolveAndCreate解析静态验证器方法中的依赖项。 当验证程序启动时,我收到以下错误“没有Http的提供者!(UsersService->Http)” 这是package.json

我正在尝试为Angular 2表单控件创建自定义异步验证程序。我有一个类,它有一个静态方法来检查服务器上用户的唯一性。我创建了一个服务(UsersService),并在其构造函数中注入了Http服务。我正在尝试在验证器中使用此服务(UsersService)。我正在使用ReflectiveInjector.resolveAndCreate解析静态验证器方法中的依赖项。 当验证程序启动时,我收到以下错误“没有Http的提供者!(UsersService->Http)”

这是package.json中的代码段

"dependencies": {
    "@angular/common": "~2.4.0",
    "@angular/compiler": "~2.4.0",
    "@angular/core": "~2.4.0",
    "@angular/forms": "~2.4.0",
    "@angular/http": "~2.4.0",
    "@angular/platform-browser": "~2.4.0",
    "@angular/platform-browser-dynamic": "~2.4.0",
    "@angular/router": "~3.4.0",

    "angular-in-memory-web-api": "~0.2.4",
    "systemjs": "0.19.40",
    "core-js": "^2.4.1",
    "rxjs": "5.0.1",
    "zone.js": "^0.7.4"
    }
这是appmodule中的代码段

@NgModule({
    imports:[ ...,HttpModule,...],
    declarations: [...],
    bootstrap:    [ AppComponent ],
    providers:    [ UsersService ]
})
这是来自验证程序的代码段

export class UserValidators {
    static uniqueUser(control: FormControl) {
    let injector = ReflectiveInjector
        .resolveAndCreate([UsersService]);
    let userService = injector.get(UsersService);
        return new Observable((obs: any) => {
        obs.next({uniqueUser: true});
        obs.complete();
    });
这是UsersService中的代码片段

@Injectable()
    export class UsersService {
    constructor(private _http: Http) {}
    getUserByName(user: string) {
            return this._http.get("http://jsonplaceholder.typicode.com/users?user="+user)
                    .map( response => { console.log(response.json()); return response.json(); } );
    }

我还尝试了以下方法:让injector=ReflectiveInjector.resolveAndCreate([UsersService,Http,Jsonp]);这将导致以下错误:ConnectionBackend没有提供程序!(UsersService->Http->ConnectionBackend)您对此问题有什么解决方案吗?请参阅