If u need something as /search?q=asdf than you can simply use:
@RouteConfig {
{path: "https://stackoverflow.com/search", name: 'Search', component: SearchCmp}
}
//And to generate router Links use:
<a [routerLink]="['/Search']" [queryParams]="{q:'asdf'}"></a>
This will generate the href tag as <a href="https://stackoverflow.com/search" but on clicking the anchor tag will lead you to url /search?q=asdf. [queryParams] will let you add the query params with “?”, otherwise they will be appended by “;”. You can get this parameter in your SearchCmp using:
constructor(private _routeParams: RouteParams) {
var queryParam = this._routeParams.get('q');
}