Skip to content

Instantly share code, notes, and snippets.

@GulinSS
Last active August 29, 2015 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GulinSS/c506d706a6fd2e0d08da to your computer and use it in GitHub Desktop.
Save GulinSS/c506d706a6fd2e0d08da to your computer and use it in GitHub Desktop.
angular.module('...').directive('...', [
function() {
return {
scope: {
service: '@'
},
link: function (scope, elm, attrs) {
scope.serviceInjected = elm.injector().get(scope.service);
}
}
}
]);
@GulinSS
Copy link
Author

GulinSS commented Nov 18, 2014

In template:
<... service="someService"></...>

@andreychev
Copy link

А почему не стали использовать $injector.get('service')?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment