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
  • 12,826
  • 13
  • 52
  • 59

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
  • 78,495
  • 36
  • 155
  • 210