Skip to content

Instantly share code, notes, and snippets.

View midhunadarvin's full-sized avatar

Midhun A Darvin midhunadarvin

View GitHub Profile
@royto
royto / ES6 Angular Directive with injection
Last active October 25, 2017 18:01
Example of Angular Directive as ES6 class with injection
class myDirective {
constructor(userService) {
this.template = `<div>{{fullName}}</div>`;
this.restrict = 'E';
this.scope = {
user: '='
};
this.link = function(scope, element) {
scope.fullName = userService.getFullName(scope.user);
};