How pass a routerlink param from _nav.ts

Hi everyone,
I´m using CoreUI free for angular 2.9.2 and i need pass a routerlink param to a component but i can’t find how do it.
Is this possible?

Thanks, Jesús

hi,

I am new to this as well and it appears that as long as you pass a valid url that can be caught by your router then all should be well.
e.g.
{
name: ‘Login’,
url: ‘/auth/login’,
icon: ‘icon-login’,
},

Hi @Dracosoft

Use linkProps with following interface:

export interface INavLinkProps {
  queryParams?: {[k: string]: any};
  fragment?: string;
  queryParamsHandling?: 'merge' | 'preserve' | '';
  preserveFragment?: boolean;
  skipLocationChange?: boolean;
  replaceUrl?: boolean;
  state?: {[k: string]: any};
}

like:

export const navItems: INavData[] = [
  {
    name: 'Dashboard',
    url: '/dashboard',
    icon: 'icon-home',
    linkProps: { queryParams: { 'p': 'something' } }
  },
]

With:

navItems = {
  name: 'page 1', 
  url: '/page/view', 
  linkProps: { queryParams: { 'test': 'abc', 'pass': 'xyz' }
};

you get http://localhost:4200/#/page/view?test=abc&pass=xyz

If you need matrix URL notation use routerLink array of URL fragments to construct the new URL tree instead.

navItems = {
  name: 'page 1', 
  url: ['/page', 'view', { 'test': 'abc', 'pass': 'xyz' } ] 
};

and you have http://localhost:4200/#/page/view;test=abc;pass=xyz

In this case the optional route parameters are not separated by ? and & anymore as they would be in the URL query string - semicolons ; separated.