Skip to content

Instantly share code, notes, and snippets.

@shlomiassaf
Last active April 21, 2018 23:43
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 shlomiassaf/0ee4242dc589a6597249bd8c97c79aaf to your computer and use it in GitHub Desktop.
Save shlomiassaf/0ee4242dc589a6597249bd8c97c79aaf to your computer and use it in GitHub Desktop.
angular-general-purpose-template-var.ts
import { Directive, Input } from '@angular/core';
@Directive({
selector: '[var]',
exportAs: 'var'
})
export class VarDirective {
[key: string]: any;
@Input('var') set assign(value : any) {
if (value) {
Object.assign(this, value);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment