Angular [default]new user.component.ts:21:4提供的参数与调用目标的任何签名不匹配时出错

Angular [default]new user.component.ts:21:4提供的参数与调用目标的任何签名不匹配时出错,angular,ruby-on-rails-5,Angular,Ruby On Rails 5,我正在阅读angular for rails开发人员手册,正在“获取Angular2令牌以注册用户” 我的新-user.component.ts和app.module.ts与书中的匹配。你知道我遗漏了什么吗 代码如下: app.module.ts: import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; import { FormsModule } f

我正在阅读angular for rails开发人员手册,正在“获取Angular2令牌以注册用户”

我的新-user.component.ts和app.module.ts与书中的匹配。你知道我遗漏了什么吗

代码如下: app.module.ts:

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';

import { Angular2TokenService } from 'angular2-token';

import { HomeLibraryRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { NewUserComponent } from './new-user/new-user.component';

@NgModule({
  declarations: [
    AppComponent,
    NewUserComponent
  ],
  imports: [
    BrowserModule,
    FormsModule,
    HttpModule,
    HomeLibraryRoutingModule
  ],
  providers: [Angular2TokenService],
  bootstrap: [AppComponent]
})
export class AppModule { }
新用户/new-user.component.ts

import { Component, OnInit } from '@angular/core';
import { Angular2TokenService  } from 'angular2-token';

@Component({
  selector: 'app-new-user',
  templateUrl: './new-user.component.html',
  styleUrls: ['./new-user.component.css']
})
export class NewUserComponent implements OnInit {

  constructor(private _tokenService: Angular2TokenService) {
    this._tokenService.init({
      registerAccountPath: '/api/auth'
    });
  }

  ngOnInit() {
  }

  register() {
    this._tokenService.registerAccount(
      'test@example.com',
      'password',
      'password'
    );
  }
}
在webstorm中,_TokenServiceinit和registerAccount方法被列为未解析。

请尝试以下操作:

  register() {
    this._tokenService.registerAccount({
      email: 'test@example.com',
      password: 'password',
      passwordConfirmation: 'password'
    });
  }

这没有帮助,你能在这里添加你的代码吗?听起来你调用的函数的参数太多/太少,我会试试这个。自从我写了这本书的那一部分(我的书需要更新)以来,的函数签名似乎已经更改。谢谢!我目不转睛地看着,错过了找零。