Skip to content

Instantly share code, notes, and snippets.

@umutyerebakmaz
Last active December 17, 2019 22:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save umutyerebakmaz/6cc222080ddbb4bb96ee4adf6c2f5bae to your computer and use it in GitHub Desktop.
Save umutyerebakmaz/6cc222080ddbb4bb96ee4adf6c2f5bae to your computer and use it in GitHub Desktop.
Angular 8 Reactive Form input değerini güncellemek.
import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
@Component({
selector: 'app-form',
templateUrl: './form.component.html',
styleUrls: ['./form.component.scss']
})
export class FormComponent implements OnInit {
updateForm: FormGroup;
constructor(private formBuilder: FormBuilder) { }
ngOnInit() {
this.updateForm = this.formBuilder.group({
title: ['', [Validators.required, Validators.required]],
slug: ['', [Validators.required, Validators.required]],
description: ['', [Validators.required, Validators.required]]
});
}
onBlurTitle() {
const slug = 'bu-bir-slug-olmali';
this.updateForm.patchValue({ slug: slug });
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment