我不知道为什么我不能让路由器作为依赖项导入。在控制台中,我收到错误:
system.js:4 GET http://127.0.0.1:8000/angular2/src/platform/dom/dom_adapter.js 404 (Not Found)
看看他们使用几乎相同的设置的谷歌示例,所以我不太确定我哪里出错了。如果我注释掉路由器的导入,它会按预期工作。
索引.html:
<body>
<main>Loading...</main>
<script src="lib/traceur-runtime.js"></script>
<script src="lib/system.js"></script>
<script src="lib/Reflect.js"></script>
<script>
System.config({defaultJSExtensions: true});
</script>
<script src="lib/angular2.js"></script>
<script src="lib/router.js"></script>
<script>
System.import('index').catch(console.log.bind(console));
</script>
</body>
index.js:
import {Component, View, bootstrap} from 'angular2/angular2';
import {routerInjectables} from 'angular2/router';
import {stepOne} from 'step-one/step-one';
@Component({
selector: 'main'
})
/*@RouteConfig([
{path: '/', name: 'StepOne', component: stepOne, useAsDefault: true}
])*/
@View({
template: `
<h1>INIT</h1>
<router-outlet></router-outlet>
`
})
class Main {
constructor(){}
}
bootstrap(Main, [routerInjectables]);