Sidemenu item highlight depending on the current root page

Hi All,

I am using ionic sidemenu project for my application. I want to highlight an item in the sidemenu based on a condition that the page which is highlighted corresponds to the current root page.
This is working fine if it’s done in the app.component.ts.

But if set the rootpage any where else in the application. The item which gets highlighted is somewhat different.