我正在通過angular-for-rails-developer書,並且正在'Getting Angular2-令牌註冊用戶'錯誤在[默認] new-user.component.ts:21:4提供的參數不匹配調用目標的任何簽名
我的new-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 { }
新用戶/新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(
'[email protected]',
'password',
'password'
);
}
}
在webstorm中,_tokenService init和registerAccount方法被列爲未解決。
它沒有幫助,您可以在這裏添加您的代碼? –
聽起來像是你正在調用太多/很少參數的函數 – adriancarriger