Created
May 23, 2017 11:31
-
-
Save srttk/5e8eab34abcebbe76d9a2f8881e5a3ae to your computer and use it in GitHub Desktop.
Type script / ES 2015 class with propery fill method
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class Person { | |
name : string; | |
age: number; | |
fillFromJson(json: any) { | |
for (var propName in json) { | |
this[propName] = json[propName] | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment