angular2运行时出现奇怪错误“;“hellow单词”;
对于我面临的这个基本问题,我找不到一个好的标题。 我正在使用这个种子项目: 尝试从此处执行一些基本命令后: 页面无法加载。它被卡住了:“正在加载…” 贺词:angular2运行时出现奇怪错误“;“hellow单词”;,angular,Angular,对于我面临的这个基本问题,我找不到一个好的标题。 我正在使用这个种子项目: 尝试从此处执行一些基本命令后: 页面无法加载。它被卡住了:“正在加载…” 贺词: import {Component} from 'angular2/core'; @Component({ selector: 'greeting', templateUrl: 'app/greeting/greeting.html', styleUrls: ['app/greeting/greeting.css'] }) e
import {Component} from 'angular2/core';
@Component({
selector: 'greeting',
templateUrl: 'app/greeting/greeting.html',
styleUrls: ['app/greeting/greeting.css']
})
export default class Greeting {
title = 'Tour of Heroes';
heroes = ['Windstorm', 'Bombasto', 'Magneta', 'Tornado'];
myHero = this.heroes[0];
}
greeting.html:
<h1>{{title}}</h1>
<h2>My favorite hero is: {{myHero}}</h2>
<p>Heroes:</p>
<ul>
<li *ngFor="let hero of heroes">
{{ hero }}
</li>
</ul>
{{title}
我最喜欢的英雄是:{{myHero}
英雄:
-
{{英雄}}
我在webstorm上的编译器中没有任何错误,但开发人员工具控制台变得疯狂:
angular2.dev.js:23524 EXCEPTION: Template parse errors:
Can't bind to 'ngFor' since it isn't a known native property ("
<p>Heroes:</p>
<ul>
<li [ERROR ->]*ngFor="let hero of heroes">
{{ hero }}
</li>
"): Greeting@4:8
Can't bind to 'ngForHero' since it isn't a known native property ("
<p>Heroes:</p>
<ul>
<li [ERROR ->]*ngFor="let hero of heroes">
{{ hero }}
</li>
"): Greeting@4:8
Property binding ngFor not used by any directive on an embedded template ("
<p>Heroes:</p>
<ul>
[ERROR ->]<li *ngFor="let hero of heroes">
{{ hero }}
</li>
"): Greeting@4:4
Property binding ngForHero not used by any directive on an embedded template ("
<p>Heroes:</p>
<ul>
[ERROR ->]<li *ngFor="let hero of heroes">
{{ hero }}
</li>
"): Greeting@4:4
angular2.dev.js:23514 EXCEPTION: Template parse errors:
Can't bind to 'ngFor' since it isn't a known native property ("
<p>Heroes:</p>
<ul>
<li [ERROR ->]*ngFor="let hero of heroes">
{{ hero }}
</li>
"): Greeting@4:8
Can't bind to 'ngForHero' since it isn't a known native property ("
<p>Heroes:</p>
<ul>
<li [ERROR ->]*ngFor="let hero of heroes">
{{ hero }}
</li>
"): Greeting@4:8
Property binding ngFor not used by any directive on an embedded template ("
<p>Heroes:</p>
<ul>
[ERROR ->]<li *ngFor="let hero of heroes">
{{ hero }}
</li>
"): Greeting@4:4
Property binding ngForHero not used by any directive on an embedded template ("
<p>Heroes:</p>
<ul>
[ERROR ->]<li *ngFor="let hero of heroes">
{{ hero }}
</li>
"): Greeting@4:4BrowserDomAdapter.logError @ angular2.dev.js:23514BrowserDomAdapter.logGroup @ angular2.dev.js:23525ExceptionHandler.call @ angular2.dev.js:1145(anonymous function) @ angular2.dev.js:14801NgZone._notifyOnError @ angular2.dev.js:5796onError @ angular2.dev.js:5700run @ angular2-polyfills.js:141(anonymous function) @ angular2.dev.js:5719zoneBoundFn @ angular2-polyfills.js:111lib$es6$promise$$internal$$tryCatch @ angular2-polyfills.js:1511lib$es6$promise$$internal$$invokeCallback @ angular2-polyfills.js:1523lib$es6$promise$$internal$$publish @ angular2-polyfills.js:1494(anonymous function) @ angular2-polyfills.js:243microtask @ angular2.dev.js:5751run @ angular2-polyfills.js:138(anonymous function) @ angular2.dev.js:5719zoneBoundFn @ angular2-polyfills.js:111lib$es6$promise$asap$$flush @ angular2-polyfills.js:1305
angular2.dev.js:23514 STACKTRACE:BrowserDomAdapter.logError @ angular2.dev.js:23514ExceptionHandler.call @ angular2.dev.js:1147(anonymous function) @ angular2.dev.js:14801NgZone._notifyOnError @ angular2.dev.js:5796onError @ angular2.dev.js:5700run @ angular2-polyfills.js:141(anonymous function) @ angular2.dev.js:5719zoneBoundFn @ angular2-polyfills.js:111lib$es6$promise$$internal$$tryCatch @ angular2-polyfills.js:1511lib$es6$promise$$internal$$invokeCallback @ angular2-polyfills.js:1523lib$es6$promise$$internal$$publish @ angular2-polyfills.js:1494(anonymous function) @ angular2-polyfills.js:243microtask @ angular2.dev.js:5751run @ angular2-polyfills.js:138(anonymous function) @ angular2.dev.js:5719zoneBoundFn @ angular2-polyfills.js:111lib$es6$promise$asap$$flush @ angular2-polyfills.js:1305
angular2.dev.js:23514 Error: Template parse errors:
Can't bind to 'ngFor' since it isn't a known native property ("
<p>Heroes:</p>
<ul>
<li [ERROR ->]*ngFor="let hero of heroes">
{{ hero }}
</li>
"): Greeting@4:8
Can't bind to 'ngForHero' since it isn't a known native property ("
<p>Heroes:</p>
<ul>
<li [ERROR ->]*ngFor="let hero of heroes">
{{ hero }}
</li>
"): Greeting@4:8
Property binding ngFor not used by any directive on an embedded template ("
<p>Heroes:</p>
<ul>
[ERROR ->]<li *ngFor="let hero of heroes">
{{ hero }}
</li>
"): Greeting@4:4
Property binding ngForHero not used by any directive on an embedded template ("
<p>Heroes:</p>
<ul>
[ERROR ->]<li *ngFor="let hero of heroes">
{{ hero }}
</li>
"): Greeting@4:4
at new BaseException (http://localhost:3000/lib/angular2.dev.js:8080:21)
at TemplateParser.parse (http://localhost:3000/lib/angular2.dev.js:24042:15)
at http://localhost:3000/lib/angular2.dev.js:24669:54
at Zone.run (http://localhost:3000/lib/angular2-polyfills.js:138:17)
at Zone.run (http://localhost:3000/lib/angular2.dev.js:5719:32)
at zoneBoundFn (http://localhost:3000/lib/angular2-polyfills.js:111:19)
at lib$es6$promise$$internal$$tryCatch (http://localhost:3000/lib/angular2-polyfills.js:1511:16)
at lib$es6$promise$$internal$$invokeCallback (http://localhost:3000/lib/angular2-polyfills.js:1523:17)
at lib$es6$promise$$internal$$publish (http://localhost:3000/lib/angular2-polyfills.js:1494:11)
at http://localhost:3000/lib/angular2-polyfills.js:243:5
-----async gap-----
Error
at _getStacktraceWithUncaughtError (http://localhost:3000/lib/angular2-polyfills.js:2195:26)
at Zone.fork (http://localhost:3000/lib/angular2-polyfills.js:2253:40)
at Zone.bind (http://localhost:3000/lib/angular2-polyfills.js:109:48)
at bindArguments (http://localhost:3000/lib/angular2-polyfills.js:980:29)
at lib$es6$promise$promise$$Promise.obj.(anonymous function) [as then] (http://localhost:3000/lib/angular2-polyfills.js:1000:37)
at TemplateCompiler._compileComponentRuntime (http://localhost:3000/lib/angular2.dev.js:24666:14)
at RuntimeCommandFactory.componentTemplateFactory (http://localhost:3000/lib/angular2.dev.js:24695:35)
at RuntimeCommandFactory.createBeginComponent (http://localhost:3000/lib/angular2.dev.js:19934:41)
at CommandBuilderVisitor.visitElement (http://localhost:3000/lib/angular2.dev.js:20040:46)
at ElementAst.visit (http://localhost:3000/lib/angular2.dev.js:19439:22)
-----async gap-----
Error
at _getStacktraceWithUncaughtError (http://localhost:3000/lib/angular2-polyfills.js:2195:26)
at Zone.fork (http://localhost:3000/lib/angular2-polyfills.js:2253:40)
at Zone.bind (http://localhost:3000/lib/angular2-polyfills.js:109:48)
at bindArguments (http://localhost:3000/lib/angular2-polyfills.js:980:29)
at lib$es6$promise$promise$$Promise.obj.(anonymous function) [as then] (http://localhost:3000/lib/angular2-polyfills.js:1000:37)
at TemplateCompiler._compileComponentRuntime (http://localhost:3000/lib/angular2.dev.js:24666:14)
at TemplateCompiler.compileHostComponentRuntime (http://localhost:3000/lib/angular2.dev.js:24637:14)
at RuntimeCompiler_.compileInHost (http://localhost:3000/lib/angular2.dev.js:24860:37)
at DynamicComponentLoader_.loadAsRoot (http://localhost:3000/lib/angular2.dev.js:14530:29)
at useFactory (http://localhost:3000/lib/angular2.dev.js:14672:39)
-----async gap-----
Error
at _getStacktraceWithUncaughtError (http://localhost:3000/lib/angular2-polyfills.js:2195:26)
at Zone.fork (http://localhost:3000/lib/angular2-polyfills.js:2253:40)
at NgZone._createInnerZone (http://localhost:3000/lib/angular2.dev.js:5707:39)
at new NgZone (http://localhost:3000/lib/angular2.dev.js:5573:32)
at createNgZone (http://localhost:3000/lib/angular2.dev.js:14693:12)
at PlatformRef_.application (http://localhost:3000/lib/angular2.dev.js:14768:31)
at Object.bootstrap (http://localhost:3000/lib/angular2.dev.js:25054:64)
at execute (http://localhost:3000/app/bootstrap.js:14:23)
at ensureEvaluated (http://localhost:3000/lib/system.src.js:2981:26)
at Object.execute (http://localhost:3000/lib/system.src.js:3099:13)BrowserDomAdapter.logError @ angular2.dev.js:23514ExceptionHandler.call @ angular2.dev.js:1148(anonymous function) @ angular2.dev.js:14801NgZone._notifyOnError @ angular2.dev.js:5796onError @ angular2.dev.js:5700run @ angular2-polyfills.js:141(anonymous function) @ angular2.dev.js:5719zoneBoundFn @ angular2-polyfills.js:111lib$es6$promise$$internal$$tryCatch @ angular2-polyfills.js:1511lib$es6$promise$$internal$$invokeCallback @ angular2-polyfills.js:1523lib$es6$promise$$internal$$publish @ angular2-polyfills.js:1494(anonymous function) @ angular2-polyfills.js:243microtask @ angular2.dev.js:5751run @ angular2-polyfills.js:138(anonymous function) @ angular2.dev.js:5719zoneBoundFn @ angular2-polyfills.js:111lib$es6$promise$asap$$flush @ angular2-polyfills.js:1305
angular2.dev.js:23524异常:模板分析错误:
无法绑定到“ngFor”,因为它不是已知的本机属性(“
英雄:
- ]*ngFor=“让英雄中的英雄”>
{{英雄}}
"): Greeting@4:8
无法绑定到“ngForHero”,因为它不是已知的本机属性(“
英雄:
- ]*ngFor=“让英雄中的英雄”>
{{英雄}}
"): Greeting@4:8
嵌入模板上的任何指令不使用的属性绑定(“
英雄:
[错误->]-
{{英雄}}
"): Greeting@4:4
嵌入模板上的任何指令均未使用属性绑定ngForHero(“
英雄:
[错误->]-
{{英雄}}
"): Greeting@4:4
angular2.dev.js:23514异常:模板分析错误:
无法绑定到“ngFor”,因为它不是已知的本机属性(“
英雄:
- ]*ngFor=“让英雄中的英雄”>
{{英雄}}
"): Greeting@4:8
无法绑定到“ngForHero”,因为它不是已知的本机属性(“
英雄:
- ]*ngFor=“让英雄中的英雄”>
{{英雄}}
"): Greeting@4:8
嵌入模板上的任何指令不使用的属性绑定(“
英雄:
[错误->]-
{{英雄}}
"): Greeting@4:4
嵌入模板上的任何指令均未使用属性绑定ngForHero(“
英雄:
[错误->]-
{{英雄}}
"): Greeting@4:4BrowserDomAdapter.logError@angular2.dev.js:23514BrowserDomAdapter.logGroup@angular2.dev.js:23525ExceptionHandler.call@angular2.dev.js:1145(匿名函数)@angular2.dev.js:14801NgZone.\u notifyOnError@angular2.dev.js:5796onError@angular2.dev.js:5700run@angular2 polyfills.js:141(匿名函数)@angular2.dev.js:5719zoneBoundFn@angular2 polyfills.js:111lib$es6$promise$$internal$$tryCatch@angular2 polyfills.js:1511lib$es6$promise$$internal$$invokeCallback@angular2 polyfills.js:1523lib$es6$promise$$internal$$publish@angular2 polyfills.js:1494(匿名函数)@angular2 polyfills.js:243微任务@angular2.dev.js:5751run@angular2 polyfills.js:138(匿名函数)@angular2.dev.js:5719zoneBoundFn@angular2 polyfills.js:111lib$es6$promise$asap$$flush@angular2 polyfills.js:1305
angular2.dev.js:23514 STACKTRACE:BrowserDomAdapter.logError@angular2.dev.js:23514ExceptionHandler.call@angular2.dev.js:1147(匿名函数)@angular2.dev.js:14801NgZone.\u notifyOnError@angular2.dev.js:5796onError@angular2.dev.js:5700run@angular2 polyfills.js:141(匿名函数)@angular2.dev.js:5719zoneBoundFn@angular2 polyfills.js:111lib$es6$promise$$internal$$tryCatch@angular2 polyfills.js:1511lib$es6$promise$$internal$$invokeCallback@angular2 polyfills.js:1523lib$es6$promise$$internal$$publish@angular2 polyfills.js:1494(匿名函数)@angular2 polyfills.js:243微任务@angular2.dev.js:5751run@angular2 polyfills.js:138(匿名函数)@angular2.dev.js:5719zoneBoundFn@angular2 polyfills.js:111lib$es6$promise$asap$$flush@angular2 polyfills.js:1305
angular2.dev.js:23514错误:模板分析错误:
无法绑定到“ngFor”,因为它不是已知的本机属性(“
英雄:
- ]*ngFor=“让英雄中的英雄”>
{{英雄}}
"): Greeting@4:8
无法绑定到“ngForHero”,因为它不是已知的本机属性(“
英雄:
- ]*ngFor=“让英雄中的英雄”>
{{英雄}}
"): Greeting@4:8
嵌入模板上的任何指令不使用的属性绑定(“
英雄:
[错误->]-
{{英雄}}
"): Greeting@4:4
嵌入模板上的任何指令均未使用属性绑定ngForHero(“
英雄:
[错误->]-
{{英雄}}
"): Greeting@4:4
在纽约例外(http://localhost:3000/lib/angular2.dev.js:8080:21)
在TemplateParser.parse(http://localhost:3000/lib/angular2.dev.js:24042:15)
在http://localhost:3000/lib/angular2.dev.js:24669:54
在Zone.run(http://localhost:3000/lib/angular2-polyfills.js:138:17)
在Zone.run(http://localhost:3000/lib/angular2.dev.js:5719:32)
在zoneBoundFn(http://localhost:3000/lib/angular2-polyfills.js:111:19)
在lib$es6$promise$$internal$$tryCatch时(http://localhost:3000/lib/angular2-polyfills.js:1511:16)
在lib$es6$promise$$internal$$invokeCallback中(http://localhost:3000/lib/angular2-polyfills.js:1523:17)
在lib$es6$promise$$internal$$publish处(http://localhost:3000/lib/angular2-polyfills.js:1494:11)
在http://localhost:3000/lib/angular2-polyfills.js:243:5
-----异步间隙-----
错误
在(http://localhost:3000/lib/angular2-polyfills.js:2195:26)
在Zone.fork(http://localhost:3000/lib/angular2-polyfills.js:2253:40)
在Zone.bind(http://localhost:3000/lib/angular2-polyfills.js:109:48)
至少(http://localhost:3000/lib/angular2-polyfills.js:980:29)
在lib$es6$promise$promise$$promise.obj.(匿名函数)[as then](http://localhost:3000/lib/angular2-polyfills.js:1000:37)
在TemplateCompiler.\u CompileComponent运行时(http://localhost:3000/lib/angular2.dev.js:24666:14)
在运行时通信
<div *ngFor="#hero of heroes; #i=index">
{{i + 1}} - {{hero.fullName}}
</div>
<div *ngFor="let hero of heroes; let i=index">
{{i + 1}} - {{hero.fullName}}
</div>