Angular 4 route params problem on produnction build when refresh page

14 views
Skip to first unread message

Mandar Kirad

unread,
May 25, 2018, 2:22:44 PM5/25/18
to Angular and AngularJS discussion
hello all,

I have develop angular project using angular 4 CLI.

My problem is that , i have pass a id using route params using this syntax 

in another component file
"this.router.navigate(['meeting/'+ id])"

and i have get this id using this,

let id=this.activatedRoute.snapshot.params['id']

this all are working fine at running this application, refresh on that meeting/:id page  is working,

But when a create a build of this project , that dist folder can not getting refresh on meeting/:id page,

It gives following error,
inline.dd650ebf6f8c0fe6ad8e.bundle.js:1 Uncaught SyntaxError: Unexpected token <
polyfills.a2db176b80765ff39ae2.bundle.js:1 Uncaught SyntaxError: Unexpected token <
scripts.1cd05d3e7f9761ff7fcc.bundle.js:1 Uncaught SyntaxError: Unexpected token <
vendor.ed4e3f60a7d8e487463e.bundle.js:1 Uncaught SyntaxError: Unexpected token <
main.7d1caf3d1933a8038bf1.bundle.js:1 Uncaught SyntaxError: Unexpected token <


Kindly please let me know 





2018-05-24.png

tarak jarboui

unread,
May 26, 2018, 4:10:35 AM5/26/18
to ang...@googlegroups.com
try to read the id like that :

ngOnInit() {
    this.sub = this.route.params.subscribe(params => {
       this.id = +params['id']; // (+) converts string 'id' to a number

       // In a real app: dispatch action to load the details here.
    });
  }

--
You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscribe@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages