How to put filters into the Sidemenu?

I’m trying to place filter controls into the Right side-menu which will apply to the list displayed in the side-menu content. However, the side-menu content doesn’t seem to recognize the filter. The control I am using in the side-menu is a drop-down box.

If I place the code within Side-menu content, then everything works fine.

I suppose it has something to do scope of variables, but I can’t seem to figure out how to solve this. Any help will be much appreciated.

1 Like

Can you provide a codepen of this?

Sure.

Currently the filter is in the right side menu, and doesn’t work. If we comment that out and uncomment the same filter in the content, it’ll work.

I would recommend creating a state service (or similar name) which stores the filtered values.

The right hand menu can then update the service via it’s controller, and the main content controller could watch for changes in the state services value. This can be applied throughout your app.

If you need examples let me know, but I’m not about until Monday.

Yes please. Some examples would be appreciated.

Thanks!

I know this is an old thread, but I haven’t found this addressed anywhere else directly. I’ve been struggling with this as well would love some sample code for how to make a filter work from the side menu.

Also, @n40jpj, the Angular docs recommend against stateful filtering (see e.g. http://stackoverflow.com/questions/25877704/what-is-stateful-filtering-in-angularjs) - can you explain why stateful filtering would be optimal in this situation?

@s3raph, understood that the filter works when it’s in the main content. What can we do so that the filter does work when placed in the side menu?

thanks in advance - m

I see s3raph’s filter example wasn’t an example of how to do a filter in the side menu, it was a filter that works when in the content of a page but not in the side menu. @s3raph, please disregard my comment. thanks.