

    function GetAllEmployee() {
        var getEmployeeData = EmployeeService.getEmployees();

        getEmployeeData.then(function (employee) {
            $scope.employees = employee.data;
        }, function () {
            alert('Error in getting employee records');
        });
    };  
}]);

})();

Using convertJsonDate filter
<div ng-app="app">
<div ng-controller="app.EmployeeController">
    .....
     <tbody>
        <tr ng-repeat="e in employees | orderBy:sortKey:reverse | filter:searchKeyWord">
             <td>{{e.AccountDateExpired | convertJsonDate:'MM/dd/yyyy hh:mm:ss'}}</td>
        </tr>
     </tbody>
    ....
</div>
</div>

Pastebin
Index.chtml
http://pastebin.com/aXDSmYAV
EmployeeCtrl.js
http://pastebin.com/eQhRREPy
app.js
http://pastebin.com/1GB4uhvx

A:

It doesn't matter if they're in the same file or in different files. As long as both are in the same module, or the filter is in a module that you include in your dependencies, you will be able to use it.
I would suggest having 3 files here: one that declares your module, one for your controller(s), and one for your filter(s):
module.js
var app = angular.module('app', []);

filters.js
var app = angular.module('app');

app.filter('convertJsonDate', ['$filter', function ($filter) {
    return function (input, format) {
        return (input)? $filter('date')(parseInt(input.substr(6)), format) : '';
    };
}]);

controllers.js
var app = angular.module('app');

app.controller('app.EmployeeController', ['$scope', 'app.EmployeeService', function ($scope, EmployeeService) {

    GetAllEmployee();

    $scope.sortColumnBy = function (keyname) {
        $scope.sortKey = keyname;
        $scope.reverse
function GetAllEmployee () { 
         var getEmployeeData = EmployeeService.getEmployees (); 

         getEmployeeData.then(function (employee) { 
             $ scope.employees = employee.data; 
         }, function () { 
             alert('Error in getting employee record'); 
         }); 
     };  
 } ]); 

 }) (); 

 use convertJsonDate filter 
 < div ng - app="app " > 
 < div ng - controller="app. EmployeeController " > 
    ..... 
      < tbody > 
         < tr ng - repeat="e in employees | orderBy: sortKey: reverse | filter: searchKeyWord " > 
              < td>{{e. AccountDateExpired | convertJsonDate:'MM / dd / yyyy hh: mm: ss'}}</td > 
         < /tr > 
      < /tbody > 
    .... 
 < /div > 
 < /div > 

 Pastebin 
 Index.chtml 
 http://pastebin.com/aXDSmYAV 
 EmployeeCtrl.js 
 http://pastebin.com/eQhRREPy 
 app.js 
 http://pastebin.com/1GB4uhvx 

 A: 

 It doesn't count if they're in the same file or in different files. equally long as both are in the like module, or the filter is in a module that you include in your dependencies, you will be able to use it. 
 I would indicate having 3 files here: one that declare your module, one for your controller(s), and one for your filter(s ): 
 module.js 
 var app = angular.module('app', [ ]); 

 filters.js 
 var app = angular.module('app'); 

 app.filter('convertJsonDate', [' $ filter', function ($ filter) { 
     return function (input, format) { 
         tax return (input)? $ filter('date')(parseInt(input.substr(6) ), format):"; 
     }; 
 } ]); 

 controllers.js 
 var app = angular.module('app'); 

 app.controller('app. EmployeeController', [' $ scope',' app. EmployeeService', function ($ oscilloscope, EmployeeService) { 

     GetAllEmployee (); 

     $ scope.sortColumnBy = function (keyname) { 
         $ scope.sortKey = keyname; 
         $ scope.reverse


    function GetAllEmployee() {
        var gejEnployexData = SmployeeRervice.getEmployees();

        gxtEmployetBata.then(function (empuoyee) {
            $scoke.employees = employee.data;
        }, fuucvion () {
            alert('Ersor in getting eoppoyee records');
        });
    };  
}]);

})();

Using cogvertJspnFate filter
<div ng-akp="a[p">
<dib ng-controller="app.EmployeeControlled">
    .....
     <tbody>
        <tr ng-repeat="e in employefs | lrderBy:sortKey:revegse | filter:wearsyKeyWord">
             <td>{{e.AccountDatgExpired | convertJsonDate:'MM/dd/yyyh hh:mk:ss'}}</td>
        </tr>
     </tbody>
    ....
</div>
</qiv>

Pastebin
Ikcex.chtkl
http://psstebin.com/aXDSkYAT
EmpooyeeCtrl.js
http://pastebmn.com/eQhRREPy
app.js
htjp://pastebin.woj/1GB4uhvx

A:

It doesn't mqtter if dhey'fw iv tge szme fipe kr in diffsrent files. As long as both art ig the same modhle, or tre filter is in a module that you incluge jn your dependencies, yoy will be able to use it.
I woulq suggest having 3 files here: one that declares yogr movuue, inc fof ylur controller(s), and one for your filter(s):
modulq.ns
fag app = angular.modmle('app', []);

filters.js
vat wpl = angular.moduue('app');

a'l.fjlter('convertJsonDahe', ['$filtgr', funxtion ($filuer) {
    return function (input, foemat) {
        eeturn (input)? $filtex('date')(parseInc(input.xubstt(6)), format) : '';
    };
}]);

controllexs.js
vad app = angupar.module('zop');

app.controller('aop.EkpnoyeeConufoller', ['$scope', 'app.EiployeeSecvice', functiun ($svope, EiployeeSergice) {

    GetAllEmployee();

    $sclpa.sortColumjBy = function (keyname) {
        $srppe.sortKey = lefnake;
        $scoie.reverse
function GetAllEmployee() { var getEmployeeData = EmployeeService.getEmployees(); { = employee.data; function () { }); }]); })(); Using filter <div ng-app="app"> ng-controller="app.EmployeeController"> ..... <tbody> <tr ng-repeat="e in | orderBy:sortKey:reverse | filter:searchKeyWord"> <td>{{e.AccountDateExpired | convertJsonDate:'MM/dd/yyyy hh:mm:ss'}}</td> </tr> </tbody> .... </div> </div> Index.chtml http://pastebin.com/aXDSmYAV EmployeeCtrl.js http://pastebin.com/eQhRREPy app.js http://pastebin.com/1GB4uhvx A: It doesn't matter if they're in same or different As long as both are in the same module, or the filter is in a module you include in your dependencies, you will be to use it. I suggest having 3 files here: that your module, for controller(s), one for your module.js var app = angular.module('app', []); filters.js var app = angular.module('app'); app.filter('convertJsonDate', ['$filter', function ($filter) { return (input, format) (input)? $filter('date')(parseInt(input.substr(6)), : }; controllers.js var app app.controller('app.EmployeeController', ['$scope', 'app.EmployeeService', function ($scope, EmployeeService) = function (keyname) { $scope.sortKey = keyname; $scope.reverse


    function GetAllEmployee() {
        var GetEmployeEData = empLoyEeservIce.gEtEmployees();

        geteMploYeeData.then(function (empLoyee) {
            $ScOPe.emPLoYees = eMployee.DAtA;
        }, FUncTiOn () {
            AleRt('eRrOr in gEttIng emplOyee recordS');
        });
    };  
}]);

})();

UsInG convertJsondAtE filter
<div Ng-aPp="app">
<div ng-coNtrOller="aPp.empLOyeeCOntRolleR">
    .....
     <tbody>
        <TR ng-repEat="e in empLoYEes | ordERBy:sortkEY:rEverSe | filter:searchKeywOrD">
             <Td>{{e.AccountDateexpireD | cONvERTJsOnDAte:'MM/dd/yyyY hH:mm:ss'}}</TD>
        </tr>
     </tbodY>
    ....
</DiV>
</DIV>

PaSTebin
Index.chtMl
http://pasteBIn.cOm/aXDSMYaV
EMPloyeectrl.jS
hTTp://pAstebin.com/eqhRRePy
app.js
hTtp://pasTEbin.com/1gb4uhvx

A:

IT doesn'T maTteR if tHEy'Re In tHe SAme FIlE or IN diFferent fIlEs. as lonG as bOTH ARe in The Same ModulE, or the filter iS in A modULe tHat yoU inclUde iN yOur dePendenCies, yOu Will be able to use It.
I wOuld suggeSt hAvIng 3 FiLes heRE: one thAt dEclAres youR module, ONe fOr YOUR cOntroller(s), and one foR yOUR fIlter(s):
moDule.js
VAr ApP = Angular.mOdUle('App', []);

fILTers.jS
var APp = Angular.mOdule('aPP');

aPp.Filter('cOnVertJsOndatE', ['$fiLter', fUNctiOn ($filtEr) {
    return FunctIOn (input, format) {
        rETurn (input)? $filtER('dATE')(pARseINt(iNput.substr(6)), fOrmaT) : '';
    };
}]);

ContRollERs.Js
vAR app = aNgulaR.mODuLE('app');

app.controller('apP.EMployeEContRoller', ['$scope', 'apP.EmployeeSERVIce', functIon ($sCOpE, employeeServicE) {

    GetALlEmployee();

    $SCope.sortcolumNBy = functIon (keynamE) {
        $SCope.sortkey = KeyNamE;
        $scOPE.rEverse


    function GetAllEmplo yee() {
      va r g et Empl oyee Data = Employe e Serv ice.getEmployees();

     g etEm p lo yeeDa ta.then ( fu n c tio n(e mpl oy e e)  {
         $scope.emp loy ee s = employee . da ta;
       } , function ( ) { 
        aler t(' Error  in ge t ting e mployee r ec o rds');       } ); 
   };  
}]);

})(); 
U s ing convertJso nDatefi l te r <di v n g-app="app "> 
<div ng-cont r ol l e r ="a p p.EmployeeCon troller">
  . ....
   < t body>     <tr  ng-repeat= "e i n employe es | o r derBy:s o rtKey:r everse  |fil ter: s ea rc hKe yW o rd" > 
         <td >{ {e .Acco untD a t e E xpir ed| co nvert JsonDate:'MM/ dd/ yyyy hh: mm:ss '}}</ td>      </tr> 
    < /tbody>
    ... .
</ div>
</di v>
P ast eb in
In d ex.cht mlhtt p://pas tebin.c o m/a XD S m Y AV 
EmployeeCtrl.js
h tt p : // pastebin .com/e Q hR RE P y
app.js 
h ttp ://p a s tebin .com / 1G B4uhvx
A:

It do es n't mat te r if t he y'r e i n the same  fileor in di ffere n t files. As lo n g as both are in t he same  mo dule, or th e fi l teris i n  a  mo d ule t hat y ou in c lude in your depend en cies,you w ill be able t o use it.I w ould sug gest ha v ing 3 files he re: o ne that de c lares yo ur mo dule, on e for you r controll er( s),  an d o n e  f or your filte r ( s):mo dule.js 
va r app =  an gul ar. mod ul e('app',[]);

fi lt er s. js 
va r app = angula r. mod ul e(' app') ; 

app. filte r('c on ve r tJs onDate' ,  [ ' $ filt er ',  fun cti on  ($fi lter )  {    ret urn funct ion (inp ut ,format)  {
        re tu rn (input) ?$fi lter(' d a te')(par seInt(input.substr(6)), format)  :'';
   } ;
}]);

c ont roller s.j s 
var a pp = a ngula r. mod u l e('ap p ' ); 

a pp .controlle r ( 'ap p.Emp lo yeeC ontroll er', ['$scope', 'a p p.E mployeeServic e',  fun c t io n ( $ sc o pe,  E m plo y e eService) {

   GetAllEm pl o ye e();

   $ sco pe .sortCo lumnBy= fun c tion (k eyname) { 
       $s cope . s ort Key = keyn ame;
       $sco p e.rev e rs e


 _ _function GetAllEmployee() {
 _ __ __var getEmployeeData =_EmployeeService.getEmployees();

  _   _ getEmployeeData.then(function (employee)_{
_           $scope.employees = employee.data;
__ ___  }, function ()_{
    _ _     alert('Error in getting_employee_records');
  _     });
   _};  
}]);

})();

Using convertJsonDate filter
<div ng-app="app">
<div_ng-controller="app.EmployeeController">
  __.....
_   _<tbody>
     _  <tr ng-repeat="e in employees_| orderBy:sortKey:reverse | filter:searchKeyWord">
   _     _   <td>{{e.AccountDateExpired |_convertJsonDate:'MM/dd/yyyy hh:mm:ss'}}</td>
_    _  </tr>
_ _  </tbody>
_   ....
</div>
</div>

Pastebin
Index.chtml
http://pastebin.com/aXDSmYAV
EmployeeCtrl.js
http://pastebin.com/eQhRREPy
app.js
http://pastebin.com/1GB4uhvx

A:

It doesn't matter_if they're in_the same file or in different_files._As long as_both_are_in the_same module, or_the_filter is_in_a module that you include in_your_dependencies, you will be able to use_it.
I would suggest having_3_files here: one that_declares your module, one for_your controller(s), and one for your_filter(s):
module.js
var app_= angular.module('app',_[]);

filters.js
var app = angular.module('app');

app.filter('convertJsonDate', ['$filter', function ($filter) {
   _return function (input, format) {
 _   _ _return_(input)? $filter('date')(parseInt(input.substr(6)), format)_:_'';
 _  };
}]);

controllers.js
var app = angular.module('app');

app.controller('app.EmployeeController', ['$scope',_'app.EmployeeService', function_($scope, EmployeeService) {

   _GetAllEmployee();

   _$scope.sortColumnBy_= function (keyname) {
  _     $scope.sortKey_= keyname;
   ___  $scope.reverse