typescript - Angular 2 Error while routing to another component -
i using angular 2 beta 17 error occurs.when trying route component. kindly guide me. thankful you.
import {component} 'angular2/core'; import {http, http_providers} 'angular2/http'; import {mvccomponent} "./components/mvc.component"; import {location} 'angular2/platform/common'; import {router, routedefinition, routeconfig, router_directives} "angular2/router"; @component({ selector: 'my-app', templateurl: './appscripts/layout/sidebar.html', directives: [router_directives] }) @routeconfig([ { path: '/index', name: 'index', component: mvccomponent, useasdefault: true } ]) export class appcomponent { profileimageurl: string = './images/flat-avatar.png'; public routes: routedefinition[] = null; constructor(private router: router, private location: location) { } getlinkstyle(route: routedefinition) { return this.location.path().indexof(route.path) > -1; } }
i think forgot include following file in main html file:
<script src="node_modules/angular2/bundles/router.dev.js"></script>
Comments
Post a Comment