Skip to content

Instantly share code, notes, and snippets.

constructor(private fb: FormBuilder) {}
ngOnInit(): void {
this.form = this.fb.group({
"firstname": new FormControl("", Validators.required),
"lastname": new FormControl("", Validators.required),
"address": new FormGroup({
"street": new FormControl("", Validators.required),
"housenumber": new FormControl("", [Validators.required, Validators.pattern(/\d+/g)]),
"city": new FormControl("", Validators.required)
@Component({
template: `
<form [formGroup]="form" (ngSubmit)="save()">
<div class="form-group">
<label for="firstname">firstname</label>
<input name="firstname" class="form-control" type="text" formControlName="firstname" />
<div *ngIf="form.get('firstname').touched">
<div *ngIf="form.get('firstname').hasError('required')">This field is required.</div>
</div>
</div>
@Component({
template: `
<form [formGroup]="form" (ngSubmit)="save()">
<div class="form-group">
<label for="firstname">firstname</label>
<input name="firstname" class="form-control" type="text" formControlName="firstname" />
<div *ngIf="form.get('firstname').touched">
<div *ngIf="form.get('firstname').hasError('required')">This field is required.</div>
</div>
</div>
@bastijns-jeroen
bastijns-jeroen / address-form-component.ts
Last active April 10, 2017 19:00
A reusable address form component
@Component({
selector: 'address-form-component',
template: `
<form [formGroup]="form">
<div class="form-group">
<label for="street">street</label>
<input name="street" class="form-control" type="text" formControlName="street" />
<div *ngIf="form.get('street').touched">
<div *ngIf="form.get('street').hasError('required')">This field is required.</div>
</div>
@bastijns-jeroen
bastijns-jeroen / normal-angular-reactive-form.ts
Last active April 14, 2017 06:55
An Angular reactive form sample
@Component({
template: `
<form [formGroup]="form" (ngSubmit)="save()">
<div class="form-group">
<label for="firstname">firstname</label>
<input name="firstname" class="form-control" type="text" formControlName="firstname" />
<div *ngIf="form.get('firstname').touched">
<div *ngIf="form.get('firstname').hasError('required')">This field is required.</div>
</div>
</div>
@bastijns-jeroen
bastijns-jeroen / raspberry-pi-kiosk.md
Last active November 11, 2021 05:48
Raspberry pi kiosk mode

#This is a setup for using your raspberry pi as a kiosk.

  • Install raspbian to use it as a full fledged desktop (with X so not only the terminal)

##To avoid the screen from turning itself off after 10 minutes of inactivity Install x11-xserver-utils

apt-get install x11-xserver-utils 

Now open up your ~/.xinitrc file (if you don't have one then create it) and enter this: