Private in app plugin?

I am developing an app plugin which needs to see the currently pinned filters. A previous post of mine and many searches reconfirm that I need to be using 'ui/filter_bar/filter_bar' but every reference I found to that calls Private(), which seems to be a parameter frequently passed to visualizations. My app does not get passed it and produces a "private is undefined" error.

Where does this come from and how can I receive this parameter, import it, or define it in an app?

First, about Private: this is an angular service that is responsible for taking anonymous providers like It instantiates services much like angular.module().service(name, provider) does, except it doesn't require picking a name for the service and instead uses the provider as the key, requiring that you import the provider to get it's instance.

To get an instance of the Private service in your app you'll need to inject it somewhere like in your controller of directives:

import { uiModules } from 'ui/modules'
const module = uiModules.get('myModule')
module.service('myService', function (Private) {
  // Here you can use Private to get the instance of anonymous providers

For more information about Private checkout the docs in this file:

I think the service you want is ui/filter_bar/query_filter source. You will need the Private loader to get access to this service, and it will look something like this:

import { FilterBarQueryFilterProvider } from 'ui/filter_bar/query_filter';
import { uiModules } from 'ui/modules';

uiModules.compoent('myComponent', function (Private) { 
  return {
    template: `
      <pre>{{$ctrl.globalFilters | json}}</pre>
    controller() {
      const filterBarQueryFilter = Private(FilterBarQueryFilterProvider);

      this.globalFilters = filterBarQueryFilter.getGlobalFilters()

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.