1

I am using angular 2.0.0-beta.0. the following code is right but when I use the same code in angular 2.0.0-beta-17 its showing Errors.Error image is at the end of this question Kindly guide me. I will be very thankful to you.

App.ts

    import {Component} from "angular2/core";
import {AsyncRoute, Router, RouteDefinition, RouteConfig, Location, ROUTER_DIRECTIVES} from "angular2/router";
import {ChartComponent} from "./components/chart.component";
import {ChartsComponent} from "./components/charts.component";
import {MvcComponent} from "./components/mvc.component";
import {Bootsrtap2Component} from "./components/bootstrap2.component";

import {BootstrapJavascriptComponent} from "./components/bootstrapjavascript.component";
declare var System: any;


@RouteConfig([

    {
        path: '/chart',
        name: 'Chart',
        component: ChartComponent
    },
    {
        path: '/charts',
        name: 'Charts',
        component: ChartsComponent
    },
    {
        path: '/index',
        name: 'Index',
        component: MvcComponent,
        useAsDefault: true
    }, 
    {
        path: '/components',
        name: 'Components',
        component: Bootsrtap2Component
    },
    {
        path: '/javascipt',
        name: 'Javascipt',
        component: BootstrapJavascriptComponent
    }
])

@Component({
    selector: "app",
    templateUrl: "/app/app.html",
    directives: [ROUTER_DIRECTIVES]
})

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;
    }
}

Errors

Errors

1 Answers1

0

Import Location from

import {Location} from 'angular2/platform/common';

See also Location and HashLocationStrategy stopped working in beta.16

Community
  • 1
  • 1
Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567