Skip to content
Snippets Groups Projects
Verified Commit 74d85fc8 authored by Lukas Maximilian Kimpel's avatar Lukas Maximilian Kimpel
Browse files

Implement submit function to add or edit text content

parent e9c6762e
Branches
Tags
1 merge request!92Resolve "content types (logic)"
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { TextContent } from '../text-content'; import { TextContent } from '../text-content';
import { ContentService } from '../content.service';
@Component({ @Component({
selector: 'app-creator-text-content', selector: 'app-creator-text-content',
...@@ -10,19 +11,24 @@ export class CreatorTextContentComponent implements OnInit { ...@@ -10,19 +11,24 @@ export class CreatorTextContentComponent implements OnInit {
content: TextContent = new TextContent('1', content: TextContent = new TextContent('1',
'1', '1',
'1', '0',
'Text Content 1', '',
'This is the body of Text Content 1', '',
1); 1);
constructor() { constructor(private contentService: ContentService) {
} }
ngOnInit() { ngOnInit() {
} }
submitContent() { submitContent() {
if (this.content.contentId === '1') {
this.contentService.addContent(this.content).subscribe();
} else {
// ToDo: Implement function in service
// this.contentService.updateContent(this.content).subscribe();
}
} }
} }
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment