angular-lodash icon indicating copy to clipboard operation
angular-lodash copied to clipboard

lodash as DI service

Open RopoMen opened this issue 11 years ago • 0 comments

Hi,

It would be nice if you could also add '' service as well. Even though lodash functions are available in $scope it would be nicer to have '' service in this module as well. Currently I need make that service to all projects, becasue I don't want to write $scope everytime I use lodash inside controller AND I don't want to use global '_' neither.

if('_'.length < '$scope'.length) console.log('This would be nicer to use inside controller :)');

Adding service:

.factory('_', ['$window', function($window) {
  return $window._;
}]);

and jsfiddle from that http://jsfiddle.net/RopoMen/c2sgLjou/

Br, Markku Roponen

RopoMen avatar Jan 04 '15 14:01 RopoMen