1
私はこのエラーを1日以上受けていますが、その理由はわかりません。エラー:TypeDecoratorのすべてのパラメータを解決できません:角度2 RC-6
app.module
import {NgModule} from "@angular/core";
import {BrowserModule} from "@angular/platform-browser";
import {AppComponent} from "./app.component";
import {FormsModule} from "@angular/forms";
import {LoginComponent} from "./Login/login";
import {LoginService} from "./Login/login.service";
@NgModule({
imports: [BrowserModule, FormsModule],
declarations: [AppComponent,
LoginComponent],
providers:[LoginService],
bootstrap: [AppComponent]
})
export class AppModule {
}
app.component.ts
import { Component } from '@angular/core';
@Component({
selector: 'my-app',
template: '<login></login>'
})
export class AppComponent {
}
login.model.ts
export class LoginModel{
private userName: string;
private password: string;
constructor(userName: string='', password: string=''){
this.userName = userName;
this.password = password;
}
}
login.ts
import {Component} from '@angular/core';
import {LoginModel} from "./login.model";
import {LoginService} from "./login.service";
@Component({
moduleId: module.id,
selector: 'login',
templateUrl:'./login.html',
styleUrls:['../css/styles.css'],
})
export class LoginComponent{
login:LoginModel = new LoginModel();
constructor(public loginService:LoginService){
}
onSubmit() {
this.loginService.output();
}
login.service
import {Injectable, Inject} from '@angular/core';
import {Http, Response} from '@angular/http';
import {Observable} from 'rxjs/Rx';
@Injectable
export class LoginService {
output(){
console.log("You are in the service output class...");
}
}
現在、私はちょうどので、私はルートやサービスを作成することができますコンパイルするアプリケーションを取得しようとしています。それがプロジェクトの全体のポイントでしたが、私は壁を打ち続けています。アドバイスをいただければ幸いです。 `今のところ、LoginModel =新しいLoginModel():
GitHubのリンク私の場合のlogin.service.tsで
Injectable()
に'ログイン欠けていましたか? – micronyksこれは '@ Injectable'の最後に'() 'を忘れている可能性がありますので、angular.ioのどこかで奇妙なバグが発生するかもしれないとわかりました。 – Supamiu
OMG ..........それ以上の無駄な!!!!!!!!!!!どうもありがとうございます。 – Drew1208