2016-10-12 3 views
0

Ich habe ein Upgrade auf die Winkel 2 Final Release von RC 4, und ich bin jetzt einen Fehler cannot find name 'module' auf meinen Code bekommen:Angular 2 Final Release nicht Name Modul finden - moduleId: module.id

@Component({ 
    selector: 'dashboard', 
    moduleId: module.id, 
    templateUrl: 'dashboard.component.html', 
    styleUrls: ['dashboard.component.css'], 
    styles: ['.chart {display: block; width: 100%;} .title.handle{background-color:transparent;}'] 

}) 

Irgendwelche Ideen ?

Vielen Dank im Voraus!

UPDATE, dann ist dies der Fehler:

zone.js:355 Unhandled Promise rejection: Template parse errors: 
Only void and foreign elements can be self closed "span" ("i role="presentation"><a role="menuitem" tabindex="-1" href="http://BruinAlert.ucla.edu">BruinAlert [ERROR ->]<span class="icon-external-link" /></a></li> 
            <li role="presentat"): [email protected]:138 
    Only void and foreign elements can be self closed "span" ("tion"><a role="menuitem" tabindex="-1" href="https://logon.ucla.edu/passchange.php">Change Password [ERROR ->]<span class="icon-external-link" /></a></li> 
at DirectiveNormalizer.normalizeLoadedTemplate (http://localhost:56159/node_modules/@angular/compiler//bundles/compiler.umd.js:13373:21) 
    at eval (http://localhost:56159/node_modules/@angular/compiler//bundles/compiler.umd.js:13366:53) 
    at ZoneDelegate.invoke (http://localhost:56159/node_modules/zone.js/dist/zone.js:203:28) 
    at Zone.run (http://localhost:56159/node_modules/zone.js/dist/zone.js:96:43) 
    at http://localhost:56159/node_modules/zone.js/dist/zone.js:462:57 
    at ZoneDelegate.invokeTask (http://localhost:56159/node_modules/zone.js/dist/zone.js:236:37) 
    at Zone.runTask (http://localhost:56159/node_modules/zone.js/dist/zone.js:136:47) 
    at drainMicroTaskQueue (http://localhost:56159/node_modules/zone.js/dist/zone.js:368:35) 
    at XMLHttpRequest.ZoneTask.invoke (http://localhost:56159/node_modules/zone.js/dist/zone.js:308:25)consoleError @ zone.js:355_loop_1 @ zone.js:382drainMicroTaskQueue @ zone.js:386ZoneTask.invoke @ zone.js:308 
zone.js:357 Error: Uncaught (in promise): Error: Template parse errors:(…)consoleError @ zone.js:357_loop_1 @ zone.js:382drainMicroTaskQueue @ zone.js:386ZoneTask.invoke @ zone.js:308 
+0

Ich habe meine Antwort aktualisiert, bitte überprüfen Sie –

Antwort

2

bearbeitet nach aktualisiertem Frage:

Ihre HTML-Vorlage ist falsch, Sie ein selbstschließendes Element span wie diese:

<span class="icon-external-link" />

was in HTML nicht erlaubt ist.

ändert es zu <span class="icon-external-link"></span>


Vor edit:

Sind Sie mit dem neuesten mit Webpack Winkel-cli? Wenn ja, sollten Sie alle moduleId Verweise entfernen, da diese Upgrade-Anleitung beschreibt:

https://github.com/angular/angular-cli/wiki/Upgrading-from-Beta.10-to-Beta.14

  1. Remove all mention of moduleId: module.id. In webpack, module.id is a number but Angular expect a string.
+0

Ich bin mir nicht sicher. Wie kann ich feststellen, welche Version des angular-cli ich verwende? – blubberbo

+0

'ng -v' im Terminal/cmd –

+0

in Visual Studio, das gibt den Fehler 'ng' ist nicht Erkennungsname wie der Name eines Cmdlet usw. – blubberbo

0

Versuchen Sie es dann zu entfernen, sollte es tun für alle Komponenten in Ihrer Anwendung

@Component({ 
    selector: 'dashboard', 
    templateUrl: 'dashboard.component.html', 
    styleUrls: ['dashboard.component.css'], 
    styles: ['.chart {display: block; width: 100%;} .title.handle{background-color:transparent;}'] 

}) 

app.module.ts

import { NgModule } from '@angular/core'; 
import { BrowserModule } from '@angular/platform-browser'; 

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

import { DashboardComponent } from './dashboard-component/dashboard-component.component'; 


@NgModule({ 
    imports: [ 
     BrowserModule 
    ], 
    declarations: [ 
     AppComponent, 
     DashboardComponent 
    ], 
    providers: [], 
    bootstrap: [AppComponent], 
}) 
export class AppModule { } 
+0

kommentieren es gibt mir eine große Anzahl von zone.js und Versprechen Fehler – blubberbo

+0

@blubberbo versuchen, nur entfernen dann –

+0

Entfernen sie wirft die gleichen Fehler – blubberbo

Verwandte Themen