Search code examples
angularjsbatarang

Running a filter from console for inspecting value


Is there any way to run a $filter in console using inspector? Using batarang I can get the scope attached to a specific element, but I want to run a general filter on the values in scope, how can I do it?


Solution

  • I don't really know your usecase, but if it's only for debugging you could make the $filter available globally.

    Just inject the $filter in some controller or whatever and move it to the window

    app.controller( 'MainCtrl',
      function (  $filter )
      {
         window.$filterForDebugging = $filter;
      });
    

    Now you can use

    window.$filterForDebugging('date')(new Date(), 'medium');
    // "27.08.2015 09:09:49"