我被困在爲什麼我無法獲取路由器作爲依賴項導入。在控制檯我得到的錯誤:Angular 2:導入路由器包
system.js:4 GET http://127.0.0.1:8000/angular2/src/platform/dom/dom_adapter.js 404 (Not Found)
看着他們用幾乎相同的設置谷歌的例子,所以我也不太清楚,我已經走了錯。如果我註釋掉路由器的導入,它將按預期工作。
的index.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]);
你在哪裏導入'ROUTER_DIRECTIVES'? –