Skip to content

Instantly share code, notes, and snippets.

@wpflames
Created June 27, 2022 18:37
Show Gist options
  • Select an option

  • Save wpflames/fd8cfe54b14fbc0dbcff9a2c302ea19a to your computer and use it in GitHub Desktop.

Select an option

Save wpflames/fd8cfe54b14fbc0dbcff9a2c302ea19a to your computer and use it in GitHub Desktop.
Form validation - Checkbox, dropdown, text field
import { Component } from '@angular/core';
@Component({
selector: 'course-form',
templateUrl: './course-form.component.html',
styleUrls: ['./course-form.component.scss']
})
export class CourseFormComponent {
categories = [
{ id: 1, name: 'Development'},
{ id: 2, name: 'Art'},
{ id: 3, name: 'Languages'}
];
log(x) { console.log(x); }
submit(f){
console.log(f);
console.log(f.value.contact.courseName);
console.log(f.value.categoryName.name);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment