角度错误:无法解析AppComponent的所有参数:(?)

时间:2017-04-11 21:29:00

标签: angular angularjs-scope

我将系统从角度2迁移到"角度4"我已经有2天烦人的问题...我已经修复了我给的所有错误等等......但是有一个错误让我继续这就是&# 34;无法解析AppComponent的所有参数:(?)。"

我对角度的了解不多。如果您遗漏任何信息或文件,我在这里添加。

我将更改的代码放在他们生成以下错误的位置: enter image description here

代码

  

Main.ts

import { APP_BASE_HREF } from '@angular/common';
import { LocationStrategy,
         HashLocationStrategy } from '@angular/common';
import { disableDeprecatedForms, provideForms } from '@angular/forms';
import { enableProdMode } from '@angular/core';
import { bootstrap } from '@angular/platform-browser-dynamic';

import { HTTP_PROVIDERS } from '@angular/http';


import { GlobalService } from './+frameworks/+foundation/global.service';

import { APP_ROUTER_PROVIDERS } from './app.routes';
import { AppComponent } from './app.component';

import { AuthGuard } from './+frameworks/+foundation/auth/auth.guard';
import { AuthService } from './+frameworks/+foundation/auth/auth.service';
import { Title } from '@angular/platform-browser';

bootstrap(AppComponent, [
  disableDeprecatedForms(),
  provideForms(),
  APP_ROUTER_PROVIDERS,
  {
    provide: APP_BASE_HREF,
    useValue: '<%= APP_BASE %>'
  },
  { provide: LocationStrategy, useClass: HashLocationStrategy },
  GlobalService,
  Title,
  HTTP_PROVIDERS,
  AuthGuard,
  AuthService,
]);
  

app.module.ts&lt;&lt;&lt;不存在

     

app.components

import { Component, ViewContainerRef } from '@angular/core';
import { ROUTER_DIRECTIVES } from '@angular/router';

import { HeaderbarComponent } from './+frameworks/+foundation/headerbar/headerbar.component';
import { MessageComponent } from './+frameworks/+foundation/message/message.component';


@Component({
  moduleId: module.id,
  selector: 'sd-app',
  templateUrl: 'app.component.html',
  directives: [ROUTER_DIRECTIVES,
               HeaderbarComponent,
               MessageComponent]
})
export class AppComponent {
  private viewContainerRef : ViewContainerRef;
  public constructor(viewContainerRef:ViewContainerRef) {
    this.viewContainerRef = viewContainerRef;
  }
}

代码

  

Main.ts

import { APP_BASE_HREF } from '@angular/common';
import { LocationStrategy,
         HashLocationStrategy } from '@angular/common';
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';

import { HttpModule } from '@angular/http';


import { GlobalService } from './+frameworks/+foundation/global.service';

import { APP_ROUTER_PROVIDERS } from './app.routes';

import { AuthGuard } from './+frameworks/+foundation/auth/auth.guard';
import { AuthService } from './+frameworks/+foundation/auth/auth.service';
import { Title } from '@angular/platform-browser';

import { AppModule } from './app.module';


platformBrowserDynamic().bootstrapModule(AppModule, [
  APP_ROUTER_PROVIDERS,
  {
    provide: APP_BASE_HREF,
    useValue: '<%= APP_BASE %>'
  },
  { provide: LocationStrategy, useClass: HashLocationStrategy },
  GlobalService,
  Title,
  HttpModule,
  AuthGuard,
  AuthService,
]);
  

app.module.ts

import { NgModule } from '@angular/core';
import {BrowserModule} from '@angular/platform-browser';
import { AppComponent } from './app.component';
import { HeaderbarComponent } from './+frameworks/+foundation/headerbar/headerbar.component';
import { MessageComponent } from './+frameworks/+foundation/message/message.component';
@NgModule({
  imports: [BrowserModule],
  declarations: [AppComponent, HeaderbarComponent, MessageComponent],
  bootstrap: [AppComponent]
})
export class AppModule {}
  

app.component.ts

import { Component, ViewContainerRef } from '@angular/core';

@Component({
  moduleId: module.id,
  selector: 'sd-app',
  templateUrl: 'app.component.html'
})
export class AppComponent {
  private viewContainerRef : ViewContainerRef;
  public constructor(viewContainerRef:ViewContainerRef) { container ref
    this.viewContainerRef = viewContainerRef;
  }
}

0 个答案:

没有答案