I am facing a strange issue in my Angular 4 project. I am trying to navigate to a path through code (on button click). I am using router.navigate() method as follows to accomplish the job --
this._router.navigate(["/employeeDetails", selectedEmployee.EmployeeId]);
Where selectedEmployee.EmployeeId is a number.
The navigation happens but I am getting a very weird thing in the URL. Initially the URL shows as follows --
http://localhost:4200/?employeeDetails/170 and then the ? sign vanishes from the URL and the required page is loaded.
Can anyone please tell me why the ? sign is coming in the URL. Ideally it should load the respective component for the route "/employeeDetails" without refreshing the page. I also tried the code without / as follows but no help.
this._router.navigate(["/employeeDetails", selectedEmployee.EmployeeId]);
Any help would be appreciated.