Last active
February 23, 2017 16:50
-
-
Save emolr/6e77d6dec1a23babae7bde096ff7b4e7 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| // article-form.model.ts | |
| import {FormGroup, FormControl, Validators} from "@angular/forms"; | |
| import {IArticle} from "./article-form.interface"; | |
| export class ArticleModel { | |
| public id: string; | |
| public authorId: string; | |
| public title: string; | |
| public description: string; | |
| public content: string; | |
| public published: boolean; | |
| /*Here we build the model object | |
| that will hold all form values.*/ | |
| constructor(data: IArticle) { | |
| Object.keys(data).forEach(val => { | |
| this[val] = data[val]; | |
| }); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment