>I have had this error for over a day and I am not sure why.app.moduleimport {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.tsimport { Component } from '@angular/core';@Component({ selector: 'my-app', template: '<login></login>'})export class AppComponent {}login.model.tsexport class LoginModel{ private userName: string; private password: string; constructor(userName: string='', password: string=''){ this.userName = userName; this.password = password; }}login.tsimport {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.serviceimport {Injectable, Inject} from '@angular/core';import {Http, Response} from '@angular/http';import {Observable} from 'rxjs/Rx';@Injectableexport class LoginService { output(){ console.log("You are in the service output class..."); }}Currently I am just trying to get the application to compile so I can creating the routes and services. That was the whole point of the project but I keep hitting walls. Any advice will be greatly appreciated.GitHub LinkLINK 解决方案 In my case login.service.ts was missing the () in Injectable() 这篇关于错误:无法解析TypeDecorator的所有参数:Angular 2 RC-6的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-10 19:40