108. Why would you Need Services
Jul 15, 2026 04:40
· 2:04
· English
· Whisper Turbo
· 2 Hátalar
Ūessi afritunarskrá rennur út í dag.
Uppfærsla fyrir varanlega geymslu →
Sýna aðeins
0:02
S…
Speaker 2 (108. Why would you Need Services)
Here's an example app which you can find attached to this lecture.
0:05
S…
Speaker 2 (108. Why would you Need Services)
Here we can create some accounts.
0:07
S…
Speaker 2 (108. Why would you Need Services)
You see we start with three accounts here at the bottom.
0:10
S…
Speaker 2 (108. Why would you Need Services)
We can switch the status of these accounts and you can see that whenever I
0:14
S…
Speaker 2 (108. Why would you Need Services)
switch it I log something to the console.
0:16
S…
Speaker 2 (108. Why would you Need Services)
You can also see that this gets locked if I create
0:20
S…
Speaker 2 (108. Why would you Need Services)
a new account here.
0:21
S…
Speaker 2 (108. Why would you Need Services)
And overall what we got here is the logging and
0:25
S…
Speaker 1 (108. Why would you Need Services)
the data storage.
0:26
S…
Speaker 2 (108. Why would you Need Services)
So in general tasks which might be centralized.
0:29
S…
Speaker 2 (108. Why would you Need Services)
We also communicate between these components.
0:32
S…
Speaker 2 (108. Why would you Need Services)
That's another area where services can be really helpful.
0:36
S…
Speaker 2 (108. Why would you Need Services)
Because let's have a look at our code.
0:38
S…
Speaker 2 (108. Why would you Need Services)
I got three components.
0:40
S…
Speaker 2 (108. Why would you Need Services)
The app component,
0:41
S…
Speaker 2 (108. Why would you Need Services)
then the account and the new account component.
0:44
S…
Speaker 2 (108. Why would you Need Services)
The app component is where all comes together.
0:47
S…
Speaker 2 (108. Why would you Need Services)
There in the template I embed the app new account and the app account component
0:52
S…
Speaker 2 (108. Why would you Need Services)
and I use property and event binding to pass data around.
0:56
S…
Speaker 1 (108. Why would you Need Services)
For example,
0:57
S…
Speaker 2 (108. Why would you Need Services)
I loop through all accounts,
0:58
S…
Speaker 2 (108. Why would you Need Services)
which are right now stored in the app component here,
1:01
S…
Speaker 2 (108. Why would you Need Services)
and I pass them via property binding to the app account
1:05
S…
Speaker 2 (108. Why would you Need Services)
component here.
1:06
S…
Speaker 2 (108. Why would you Need Services)
And there,
1:08
S…
Speaker 2 (108. Why would you Need Services)
on the other hand,
1:09
S…
Speaker 2 (108. Why would you Need Services)
I have an event,
1:10
S…
Speaker 2 (108. Why would you Need Services)
which gets fired when I click one of the three change the status buttons,
1:14
S…
Speaker 2 (108. Why would you Need Services)
which is submitted here,
1:15
S…
Speaker 2 (108. Why would you Need Services)
which will be catched by my app component,
1:19
S…
Speaker 2 (108. Why would you Need Services)
where I then handle it again.
1:20
S…
Speaker 2 (108. Why would you Need Services)
So I do have event binding to be informed in my app component whenever
1:24
S…
Speaker 2 (108. Why would you Need Services)
something changes in the account component.
1:27
S…
Speaker 2 (108. Why would you Need Services)
Pretty much the same happens in the new account component.
1:30
S…
Speaker 2 (108. Why would you Need Services)
There I can also listen to a click when I create a new account and on
1:34
S…
Speaker 2 (108. Why would you Need Services)
such a click, I emit some data to the app component.
1:38
S…
Speaker 2 (108. Why would you Need Services)
So this is all fine,
1:40
S…
Speaker 2 (108. Why would you Need Services)
but we already got quite a complex setup here to pass data around.
1:44
S…
Speaker 2 (108. Why would you Need Services)
And that even though that it's still relatively simple,
1:47
S…
Speaker 2 (108. Why would you Need Services)
it's not a complex app here after all.
1:50
S…
Speaker 2 (108. Why would you Need Services)
Now in this lecture,
1:51
S…
Speaker 2 (108. Why would you Need Services)
we're going to see how services can help us with that and what we
1:56
S…
Speaker 2 (108. Why would you Need Services)
have to watch out for.
1:57
S…
Speaker 2 (108. Why would you Need Services)
So let's dive into it and build our first service in the
2:01
S…
Speaker 1 (108. Why would you Need Services)
next lecture.
Þessi afritun var búin til af AI (sjálfvirk talgreining). Getur innihaldið villur - staðfesta gegn upprunalegu hljóðinu til mikilvægrar notkunar. AI stefna
Samantekt
Smelltu á Samantekt til að búa til AI samantekt á þessari afritun.
Samantekt...
Spyrja AI um þessa afritun
Spyrðu eitthvað um þetta afritunarrit - AI mun finna viðeigandi hluta og svara.