Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:01,430 --> 00:00:01,730
All right.
2
00:00:01,730 --> 00:00:05,130
Let's go over a solution to these two steps right here.
3
00:00:05,150 --> 00:00:07,600
We're going to first begin by opening up our app component.
4
00:00:07,600 --> 00:00:10,730
Once again here's my app component.
5
00:00:10,790 --> 00:00:15,310
I've got that Lorem sub module right there and it has that sentences function on it.
6
00:00:15,340 --> 00:00:19,760
So to make sure that we've got some initial sentence to display to the user I'm going to initialize
7
00:00:19,790 --> 00:00:23,870
a new property inside of my app component right now inside of app component.
8
00:00:23,870 --> 00:00:27,260
There's already an existing property inside of here of title.
9
00:00:27,260 --> 00:00:31,450
This property gets added in automatically every single time you generate a new project.
10
00:00:31,490 --> 00:00:32,870
It doesn't actually get used at all.
11
00:00:32,870 --> 00:00:35,580
So we can safely delete that property.
12
00:00:35,600 --> 00:00:38,120
Now I'm going to assign a new property to this thing.
13
00:00:38,330 --> 00:00:47,690
I'll call it random text and I'm going to give it an initial value of Lorem dot sentence like so I'm
14
00:00:47,690 --> 00:00:52,100
going to tell you right away that throughout this application you and I are probably going to use different
15
00:00:52,100 --> 00:00:56,810
variables and different property names like all over the place right now.
16
00:00:56,810 --> 00:01:01,460
I would really encourage you to use the name random text right here as we're going to end up doing a
17
00:01:01,460 --> 00:01:05,280
little bit of refactoring to in order to actually make our application work.
18
00:01:05,540 --> 00:01:09,560
And when we start to do that refactoring it's gonna be a lot easier if you and I have some identical
19
00:01:09,560 --> 00:01:11,590
property names right now.
20
00:01:11,660 --> 00:01:15,470
If you have some code that looks like this I would encourage you to change the property that name that
21
00:01:15,470 --> 00:01:20,110
you use to simply random text OK.
22
00:01:20,140 --> 00:01:24,610
So now that we've got that property put together we can now reference that inside of our template.
23
00:01:24,730 --> 00:01:28,930
That's how we're going to achieve the last step right here there to reference a property inside of our
24
00:01:28,930 --> 00:01:29,540
template.
25
00:01:29,590 --> 00:01:35,260
We will open up our component template file which is app component dot each team l inside of here.
26
00:01:35,270 --> 00:01:40,160
I'll find where we have that kind of place holder to show some randomly generated text not going to
27
00:01:40,160 --> 00:01:46,260
delete that hardcoded stuff or then replace it with a reference to that random text property.
28
00:01:46,420 --> 00:01:50,890
Remember if we ever want to print out some content to show to the user we're going to use the template
29
00:01:50,920 --> 00:01:55,270
interpolation syntax which is that set of double curly braces.
30
00:01:55,460 --> 00:02:02,810
Go inside there I'll say random text like so I'll then save this you know flip back over and I can see
31
00:02:02,810 --> 00:02:08,030
I've got some random sentence on the screen now every single time I refresh the page I see a different
32
00:02:08,030 --> 00:02:10,580
random sentence okay.
33
00:02:10,650 --> 00:02:13,980
Let's say this looks pretty good.
34
00:02:14,070 --> 00:02:19,670
Now let's move on to our next set of steps the next we're going to work on is making sure that we can
35
00:02:19,670 --> 00:02:24,770
detect whenever user types inside that text input that we need to detect when the user types in there
36
00:02:24,830 --> 00:02:29,330
and take a look at whatever character the user just added in and we can use that to decide whether or
37
00:02:29,330 --> 00:02:35,520
not the user is entering in text that's identical to our randomly generated string right there right
38
00:02:35,520 --> 00:02:40,770
now we just really need to detect whenever user types inside that text input make sure you add in some
39
00:02:40,770 --> 00:02:44,510
code to detect a typing event also.
40
00:02:44,520 --> 00:02:49,310
Once you add that in make sure that you can verify that it all works by console logging out wherever
41
00:02:49,320 --> 00:02:51,900
the user is typing into the input.
42
00:02:51,930 --> 00:02:56,430
Now just so you know if you start to Google for a solution to step right here you're going to see that
43
00:02:56,460 --> 00:03:02,480
angular has a lot of different ways to handle typing events are essentially input into any input elements
44
00:03:02,970 --> 00:03:08,670
that we already took a look at how to handle text input on our last application around or see our first
45
00:03:08,670 --> 00:03:09,450
application.
46
00:03:09,450 --> 00:03:11,550
Remember it was that password generator.
47
00:03:11,550 --> 00:03:15,620
So I would encourage you rather than googling on how to do some steps like this right here.
48
00:03:15,780 --> 00:03:21,250
Go back to our password generator application and take a look at how we handled text input inside there.
49
00:03:21,250 --> 00:03:27,220
Now I would encourage you to use the same steps to solve this set of steps right here okay.
50
00:03:27,230 --> 00:03:31,270
So again go ahead and give it a shot on your own and we'll come back in the next video and go over resolution
51
00:03:31,400 --> 00:03:31,820
together.
5748
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.