dimanche 21 avril 2019

I want to handle route param and query string param by the same component

I am new to angular. I have a project which i am working on. It has a component which has route that accepts a path param like http://mydomain/school/teacher/1001/courses where 1001 is teacher's UniqueId which is application generated in our database.

But now I also need to fulfill requirement so that if someone types in browser, http://mydomain/school/teacher/courses?ssn=92899

Then it finds the teacher by ssn and gets his UniqueId and then routes it to http://mydomain/school/teacher/1001/courses

Where UniqueId 1001 is of a teacher who has ssn=92899

How can i accomplish this?

Should i Create a new component which maps to path "http://mydomain/school/teacher/courses" and inside the new component i find the related UniqueId and then redirect? Please let me know correct approach.




Aucun commentaire:

Enregistrer un commentaire