Last active
February 23, 2017 16:26
-
-
Save emolr/8be68eb8e117621156f26ba7561c5500 to your computer and use it in GitHub Desktop.
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
// app.component.ts | |
import {Component} from '@angular/core' | |
import {ArticleFormService} from 'src/models/app-forms/article-form/article-form.service.ts' | |
@Component({ | |
selector: 'my-app', | |
templateUrl: 'src/app.component.html' | |
}) | |
export class AppComponent { | |
public isSending = this.articleFormService.isSending$; | |
public succeeded = this.articleFormService.succeeded$; | |
public failed = this.articleFormService.failed$; | |
public initialFormConfig = { | |
authorId: 'authorExampleId', | |
title: '', | |
description: '', | |
content: '', | |
published: false | |
}; | |
constructor(public articleFormService: ArticleFormService) { | |
this.articleFormService.configure(this.initialFormConfig); | |
} | |
public create() { | |
this.articleFormService.request('create').then(response => { | |
this.response = response; | |
}); | |
} | |
public clear() { | |
this.articleFormService.configure(this.initialFormConfig); | |
this.response = null; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment