نمایش فقط
0:02
S… Speaker 2 (227. Resetting the Form)
So let's reset the form once we click update or add.
0:05
S… Speaker 2 (227. Resetting the Form)
Definitely go ahead and try it on your own.
0:07
S… Speaker 2 (227. Resetting the Form)
Time to pause the video now before I will show you how I would do that.
0:11
S… Speaker 1 (227. Resetting the Form)
So were you
0:15
S… Speaker 2 (227. Resetting the Form)
successful?
0:16
S… Speaker 2 (227. Resetting the Form)
There is something tricky about that.
0:18
S… Speaker 2 (227. Resetting the Form)
But let's start with the straightforward part.
0:20
S… Speaker 2 (227. Resetting the Form)
After we saved our updated value,
0:24
S… Speaker 2 (227. Resetting the Form)
or either saved the updated value or the new value I should say,
0:27
S… Speaker 2 (227. Resetting the Form)
we can of course call form reset here.
0:32
S… Speaker 2 (227. Resetting the Form)
Now if I do this,
0:34
S… Speaker 2 (227. Resetting the Form)
let's see if it works as expected.
0:36
S… Speaker 2 (227. Resetting the Form)
If I type bread here,
0:37
S… Speaker 2 (227. Resetting the Form)
10,
0:38
S… Speaker 2 (227. Resetting the Form)
and I click add,
0:39
S… Speaker 2 (227. Resetting the Form)
it resets,
0:41
S… Speaker 2 (227. Resetting the Form)
so this works.
0:42
S… Speaker 2 (227. Resetting the Form)
If I select tomatoes and change this to bread,
0:46
S… Speaker 2 (227. Resetting the Form)
it updates it to bread.
0:48
S… Speaker 2 (227. Resetting the Form)
But now we're stuck in the update mode.
0:51
S… Speaker 2 (227. Resetting the Form)
If I add bread again,
0:53
S… Speaker 2 (227. Resetting the Form)
maybe 12,
0:55
S… Speaker 2 (227. Resetting the Form)
it still updates the old one,
0:57
S… Speaker 2 (227. Resetting the Form)
right? It doesn't add a new one because we never leave the edit mode.
1:01
S… Speaker 2 (227. Resetting the Form)
The reason for this,
1:02
S… Speaker 2 (227. Resetting the Form)
of course, is that initially we are in edit mode set to false,
1:07
S… Speaker 2 (227. Resetting the Form)
then we switch it to true whenever we get the started editing
1:11
S… Speaker 2 (227. Resetting the Form)
observable to fire,
1:12
S… Speaker 2 (227. Resetting the Form)
but we never switch it back.
1:15
S… Speaker 1 (227. Resetting the Form)
Well,
1:16
S… Speaker 2 (227. Resetting the Form)
we should switch it back,
1:17
S… Speaker 2 (227. Resetting the Form)
and actually we only need to switch it back here in
1:22
S… Speaker 2 (227. Resetting the Form)
onAddItem.
1:23
S… Speaker 2 (227. Resetting the Form)
Here I can simply call this edit mode
1:26
S… Speaker 2 (227. Resetting the Form)
And set it to false,
1:27
S… Speaker 2 (227. Resetting the Form)
no matter what it was before.
1:29
S… Speaker 2 (227. Resetting the Form)
This ensures that we definitely leave it because we are done.
1:33
S… Speaker 2 (227. Resetting the Form)
Also,
1:34
S… Speaker 2 (227. Resetting the Form)
we could rename this onAddItem to simply
1:39
S… Speaker 2 (227. Resetting the Form)
say onSubmit because onAddItem is not correct all
1:43
S… Speaker 1 (227. Resetting the Form)
the times.
1:43
S… Speaker 2 (227. Resetting the Form)
But that is not important.
1:45
S… Speaker 2 (227. Resetting the Form)
That is just a little cosmetic change.
1:47
S… Speaker 2 (227. Resetting the Form)
Also rename it in the template then,
1:49
S… Speaker 2 (227. Resetting the Form)
though. So with this in place,
1:53
S… Speaker 2 (227. Resetting the Form)
If we now try this again,
1:55
S… Speaker 2 (227. Resetting the Form)
let's add a new item,
1:56
S… Speaker 2 (227. Resetting the Form)
that works.
1:57
S… Speaker 2 (227. Resetting the Form)
Let's add an existing one,
1:59
S… Speaker 2 (227. Resetting the Form)
bananas,
2:00
S… Speaker 1 (227. Resetting the Form)
two.
2:02
S… Speaker 2 (227. Resetting the Form)
And now let's try adding schnitzel,
2:07
S… Speaker 1 (227. Resetting the Form)
one.
2:09
S… Speaker 2 (227. Resetting the Form)
Now you see,
2:11
S… Speaker 2 (227. Resetting the Form)
that seems to work again.
2:13
S… Speaker 2 (227. Resetting the Form)
Now we can correctly update,
2:16
S… Speaker 2 (227. Resetting the Form)
oops,
2:17
S… Speaker 1 (227. Resetting the Form)
tomatoes,
2:18
S… Speaker 2 (227. Resetting the Form)
our items here,
2:19
S… Speaker 2 (227. Resetting the Form)
and it switches between edit mode and update mode.
2:23
S… Speaker 2 (227. Resetting the Form)
Of course,
2:24
S… Speaker 2 (227. Resetting the Form)
I also need to make sure that the delete and
2:28
S… Speaker 2 (227. Resetting the Form)
clear button works.
2:29
S… Speaker 2 (227. Resetting the Form)
So let's work on the clear button next.

این رونوشت توسط AI (شناسایی خودکار گفتار) تولید شد. ممکن است حاوی خطا باشد — برای استفادهٔ حیاتی با صدای اصلی بررسی کنید. سیاست هوش مصنوعی

❤️ عاشق STT.ai هستي؟
خلاصه
برای تولید خلاصه‌ای از این رونوشت از هوش مصنوعی ، خلاصه را فشار دهید.
خلاصه کنم...
از هوش مصنوعی در مورد این رونوشت بپرسید
در این روش، هر سؤالی که در مورد این رونوشت پرسیده شود، هوش مصنوعی بخش‌های مربوطه را پیدا کرده و پاسخ می‌دهد.