Skip to content

Instantly share code, notes, and snippets.

@emolr
Last active February 23, 2017 16:50
Show Gist options
  • Select an option

  • Save emolr/6e77d6dec1a23babae7bde096ff7b4e7 to your computer and use it in GitHub Desktop.

Select an option

Save emolr/6e77d6dec1a23babae7bde096ff7b4e7 to your computer and use it in GitHub Desktop.
// 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