http://solutionoptimist.com/2013/09/30/requirejs-angularjs-dependency-injection/
Excellent way to modularize your app and handle dynamic loading of libraries through RequireJS.
tvshow in results|filter:filterText|filter:{show.genres:genreFilter}|orderBy:orderField:orderReverse"
from comments of this page. http://net.tutsplus.com/tutorials/javascript-ajax/building-a-web-app-from-scratch-in-angularjs/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+nettuts+%28Nettuts%2B%29
directives.directive('tabLoad', function() { return { link: function (scope, element, attrs) { attrs.$observe('tabLoad', function(val) { var data = angular.fromJson(val); console.log(data); console.log(data.test); // do something }); } } });newArray=$filter('orderBy')(myArray,'sortKey');
.directive('myCurrentTime', function($timeout, dateFilter) {and to use it inside of your directive you can now simply access the filter by name:
element.text(dateFilter(new Date(), format))See this fiddle for an example.