Skip to content
This repository has been archived by the owner on Apr 19, 2021. It is now read-only.

lodash as DI service #10

Open
RopoMen opened this issue Jan 4, 2015 · 0 comments
Open

lodash as DI service #10

RopoMen opened this issue Jan 4, 2015 · 0 comments

Comments

@RopoMen
Copy link

RopoMen commented Jan 4, 2015

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant