serve frontend from go
This commit is contained in:
39
web/src/app/components/post-editor/post-editor.component.ts
Normal file
39
web/src/app/components/post-editor/post-editor.component.ts
Normal file
@ -0,0 +1,39 @@
|
||||
import {
|
||||
Component,
|
||||
effect,
|
||||
EventEmitter,
|
||||
Input,
|
||||
Output,
|
||||
signal,
|
||||
} from '@angular/core';
|
||||
import { MarkdownComponent } from '../markdown/markdown.component';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { Post } from '../../shared/interfaces/post';
|
||||
|
||||
@Component({
|
||||
selector: 'app-post-editor',
|
||||
imports: [MarkdownComponent, FormsModule],
|
||||
standalone: true,
|
||||
templateUrl: './post-editor.component.html',
|
||||
})
|
||||
export class PostEditorComponent {
|
||||
@Input('post') data = signal<Post>({
|
||||
id: 0,
|
||||
title: '',
|
||||
tldr: '',
|
||||
content: '',
|
||||
});
|
||||
@Output('postChange') dataChange = new EventEmitter<Post>();
|
||||
|
||||
set title(val: string) {
|
||||
this.data.update((d) => ({ ...d, title: val }));
|
||||
}
|
||||
|
||||
set tldr(val: string) {
|
||||
this.data.update((d) => ({ ...d, tldr: val }));
|
||||
}
|
||||
|
||||
set content(val: string) {
|
||||
this.data.update((d) => ({ ...d, content: val }));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user