Issue
In my angular application I Have fetched the data from the server and it is in json format like
jsondata = {
Id: 16531914,
EmailId: "abc@gmail.com"
}
And my requirement is if the jsondata(coming from server ) has the Id then I have to navigate to the dashboard page else I have to go to the login page
Solution
you can simply use an if chek
if(jsondata.Id) return this.router.navigate([...other routes, jsondata.Id])
this.router.navigate(['/login'])
Answered By - Mohammad Babaei
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.