Skip to content

Reactive Forms exercise#45

Open
SebastianMoreyraUTN wants to merge 1 commit intoutnfrrottads:reactive-formsfrom
SebastianMoreyraUTN:reactive-forms
Open

Reactive Forms exercise#45
SebastianMoreyraUTN wants to merge 1 commit intoutnfrrottads:reactive-formsfrom
SebastianMoreyraUTN:reactive-forms

Conversation

@SebastianMoreyraUTN
Copy link
Copy Markdown

Profe hago el pull request del ejercicio de Reactive-Forms,
Saludos !

this.taskGroup = new FormGroup({
description: new FormControl('',[Validators.required]),
url: new FormControl('',[Validators.required,Validators.pattern(urlRegex)]),
id: new FormControl('')
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

me parece que este se podria evitar, pero deberias cambiar la forma en que se hace la edicion tomando los valores del form y copiandolos a la task, me parece que seria mejor

task.isCompleted = false;
this.add.emit(task);
description.value = '';
if (this.taskGroup.controls.id.value) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tal vez yo usaria dos componentes diferentes con una herencia y me fijaria en el paso anterior para ver si estoy en edicion o no o sea en la lista cuando agrego con el boton hago una cosa y uso un componente y en el otro caso uso otra. Inclusive se podria usar el mismo componente y con un poco de polimorfismo determinar si esta en edicion o no.

description.value = '';
if (this.taskGroup.controls.id.value) {
let task = new TodoItem();
task.description = this.taskGroup.controls.description.value;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

la copia de los valores es igual en las dos ramas del if, deberian ir afuera para evitar duplicaicon de codigo

Copy link
Copy Markdown
Contributor

@aotaduy aotaduy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Te deje algunas observaciones generales, pero muy bueno!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants