user3323438 user3323438 - 3 months ago 6
AngularJS Question

how to send filtered paramter to a function in angular js?

I want to send filtered date as parameter to my function, fetchData(), i tried something like this, but its giving errors. what is the correct way of doing it?

<button type="button" ng-click="gridDataCtrl.fetchData(,myDate | date:'dd-MM-yyyy')">Refresh</button>


You can do filter in controller


<button type="button" ng-click="gridDataCtrl.fetchData(,myDate)">Refresh</button>

In controller(make sure that you inject $filter):

vm.fetchData = function(name, date){
  date = $filter('date')(date, 'dd-MM-yyyy');