amezenin / encyclopedia-frontend

0 stars 0 forks source link

use forms #2

Open vahid-forghani opened 2 years ago

vahid-forghani commented 2 years ago

https://github.com/amezenin/encyclopedia-frontend/blob/1d5ccf32e76e932d6ebbb4e0337173fb836f191e/src/app/article/create-article/create-article.component.html#L7

this way is fine to use [(ngModel)] and it is one of the way you can connect one html element to the .ts file, but there is a very nice way to do this kind of form contribute which is using Angular Reactive form you can find more information here: https://angular.io/guide/reactive-forms, you can also create your own ArticleForm which includes title: FormControl and content: FormArray you can also improve your form elements and add validations as well