1

I'm trying to create an application with angular 2. I want to send the data to route from my class.

Code

@RouteConfig([
           {
             name: 'Slider', 
             component: thumbnail_gallery , 
             path: '/slider/:id' ,
             data : model 
           }
])
export class Watch extends Ext implements OnDestroy{
      public model: any; <=== i want pass this from route
}

How can I do this?

Manfred Radlwimmer
  • 13,257
  • 13
  • 53
  • 62

1 Answers1

1

Try this one:-

@RouteConfig([

    {name: 'Slider', component: thumbnail_gallery ,path: '/slider/:id' , data : model }
])


export class Watch extends Ext implements OnDestroy{

    public model: any; 
    constructor(private router: Router){}

    Demorouting(){
       this.router.navigate(['/slider', {id: this.modal}])
    }

}
Pardeep Jain
  • 84,110
  • 37
  • 165
  • 215