blubberbo blubberbo - 1 year ago 481
AngularJS Question

Angular 2 Final Release cannot find name module - moduleId:

I just upgraded to the Angular 2 Final Release from RC 4 and I am now getting an error

cannot find name 'module'
on my code:

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


Any ideas?

Thanks in advance!

UPDATE, this is the error:

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="">BruinAlert [ERROR ->]<span class="icon-external-link" /></a></li>
<li role="presentat"): WidgetBankComponent@104:138
Only void and foreign elements can be self closed "span" ("tion"><a role="menuitem" tabindex="-1" href="">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 (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

Answer Source

Edit after updated question:

Your HTML template is incorrect, you have a self-closing span element like this:

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

which is not allowed in HTML.

Change it to <span class="icon-external-link"></span>

Before edit:

Are you using the latest angular-cli with Webpack? If yes, you should remove all moduleId references, as this upgrade guide describes:

  1. Remove all mention of moduleId: In webpack, is a number but Angular expect a string.
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download