我在尝试切换到最新的RC5时遇到错误,我不知道这是什么意思:
Error: Template parse errors:
More than one component: DeviceComponent,OtherComponent ("
</div>
<div class="col-sm-12 col-md-4 col-lg-4">
[ERROR ->]<device *ngIf="authService.authenticated"></device>
</div>它奇怪地抱怨这个html。
platform.module.ts
import { HttpModule } from '@angular/http';
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
import { PlatformComponent } from './platform.component';
import {AuthService} from '../../services/auth.service';
import {CookieService} from 'angular2-cookie/core';
import { RouterModule } from '@angular/router';
import {IncrementIndexPipe} from '../../pipes/incrementIndex';
import { TruncatePipe} from '../../pipes/truncate';
import { routing,
appRoutingProviders } from './platform.component';
@NgModule({
declarations: [TruncatePipe, IncrementIndexPipe],
imports: [BrowserModule,
HttpModule,
RouterModule,
FormsModule,
routing],
bootstrap: [PlatformComponent],
providers: [AuthService, CookieService, appRoutingProviders]
})
export class PlatformModule {}我还不断地得到:
platform-browser.umd.js:937 ORIGINAL EXCEPTION: No provider for Router!发布于 2016-08-25 22:47:04
要解算,请执行以下操作:
platform-browser.umd.js:937 ORIGINAL EXCEPTION: No provider for Router!我删除了所有旧的@angular2/router-已弃用
要解决“多个组件”错误,就像@rashfmnb建议的那样,(1)删除所有的double @Component修饰符(在我的例子中不是),(2)删除@Component修饰符中重复的"selector“标记。这是,而不是以前的angular2版本中存在的问题。
https://stackoverflow.com/questions/39145891
复制相似问题