Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:01,120 --> 00:00:05,070
Now that we've gotten some administrative stuff out of the way we can start to discuss angular.
2
00:00:05,080 --> 00:00:09,250
The most common question I get about angular is what is the best way to learn it.
3
00:00:09,260 --> 00:00:12,230
Well the very best way to learn angular is to use it.
4
00:00:12,290 --> 00:00:15,590
In other words to write code and build applications.
5
00:00:15,590 --> 00:00:20,630
That's how we're going to start off this course in this very first video we're going to build an entire
6
00:00:20,660 --> 00:00:22,790
little angular application.
7
00:00:22,790 --> 00:00:25,130
This is going to be a pretty simple and straightforward app.
8
00:00:25,160 --> 00:00:28,180
We're going to build all of it inside of this one single video.
9
00:00:28,220 --> 00:00:32,270
Let's first discuss exactly what we're going to build all right.
10
00:00:32,270 --> 00:00:32,760
Here we go.
11
00:00:32,780 --> 00:00:34,410
Here's a quick little mockup.
12
00:00:34,610 --> 00:00:38,870
We're going to be making a tool that is going to take some English text that these are enters into a
13
00:00:38,870 --> 00:00:40,520
text input right here.
14
00:00:40,520 --> 00:00:45,220
Then whenever the user clicks on this translate button we're going to take that English text translated
15
00:00:45,230 --> 00:00:49,180
into Spanish and then show the results on the screen.
16
00:00:49,190 --> 00:00:54,320
This is going to work with any type of English text so we can put in any English word any sentence any
17
00:00:54,320 --> 00:00:59,870
phrase in our application will take whatever that text is and translate it into Spanish.
18
00:00:59,870 --> 00:01:04,430
Now as you would guess you and I are not going to actually be responsible for the English to Spanish
19
00:01:04,430 --> 00:01:05,360
translation.
20
00:01:05,360 --> 00:01:07,230
We're going to use an outside service for that.
21
00:01:07,810 --> 00:01:13,100
So you and I are really just gonna be focused on creating this form showing a button a text input taking
22
00:01:13,100 --> 00:01:18,050
some text and then handling the actual kind of like handoff of that text to some translation service
23
00:01:18,410 --> 00:01:22,470
and showing the result on the screen for this very first application.
24
00:01:22,510 --> 00:01:26,920
We're going to be using an online I.D. or an online code editor.
25
00:01:27,430 --> 00:01:31,330
I've already put together a little online or a pre created Project.
26
00:01:31,330 --> 00:01:33,690
You can see a link to it right here on the screen.
27
00:01:33,730 --> 00:01:38,740
We're going to use this as our starting point because I've added in a little starter code to it.
28
00:01:39,110 --> 00:01:44,140
This you know this is the only app inside this course where we're going to use an online IDC every other
29
00:01:44,140 --> 00:01:48,600
app that we work on is going to be done on your local machine.
30
00:01:48,620 --> 00:01:52,220
The last thing I want to mention before we start writing some code is that we're going to go through
31
00:01:52,220 --> 00:01:54,350
this application very very quickly.
32
00:01:54,350 --> 00:01:57,910
In other words we're going to write out code as quickly as we possibly can.
33
00:01:57,980 --> 00:02:01,270
And I'm not going to give you a lot of explanation about what is going on.
34
00:02:01,310 --> 00:02:04,840
Instead we're just going to try to finish up our application will then take a quick pause.
35
00:02:04,850 --> 00:02:09,380
We'll come back the next video and I'll give you a really big in-depth talk about all the code that
36
00:02:09,380 --> 00:02:11,330
we just authored okay.
37
00:02:11,370 --> 00:02:13,290
So then mind let's get to it.
38
00:02:13,320 --> 00:02:14,640
I'm going to take this link right here.
39
00:02:14,640 --> 00:02:18,900
Make sure you do the same you're going to take that link and we're going to visit it inside of our browser
40
00:02:21,690 --> 00:02:25,940
and right away we're going to be presented with an open file and on the right hand side you're going
41
00:02:25,940 --> 00:02:31,280
to see a little preview of our application on the left hand side you'll see a bunch of different files
42
00:02:31,280 --> 00:02:36,740
and folders that have already been created these files and folders are a starter angular application
43
00:02:37,220 --> 00:02:40,650
you're going to eventually get really familiar about everything that's going on inside of here.
44
00:02:40,910 --> 00:02:45,410
Well once again right now we're just gonna write out some code pretty much as quickly as we can.
45
00:02:46,170 --> 00:02:50,470
To get started I'm going to find a folder called s RC on the left inside.
46
00:02:50,510 --> 00:02:52,390
Inside there is a folder called app.
47
00:02:52,610 --> 00:03:00,080
I'll open that up and then inside there I'll find a file called app dot component dot t s you should
48
00:03:00,080 --> 00:03:03,450
see something like this right here.
49
00:03:03,540 --> 00:03:08,400
We're gonna first write a little bit of code into this class that you see at the very bottom.
50
00:03:08,430 --> 00:03:12,210
I know that there's probably a lot of syntax inside of here that doesn't look like typical javascript
51
00:03:12,210 --> 00:03:12,900
at all.
52
00:03:12,930 --> 00:03:17,040
Again don't sweat it where it's going to add in some code really quickly and then come back and discuss
53
00:03:17,130 --> 00:03:19,870
what is going on inside here.
54
00:03:19,880 --> 00:03:20,170
All right.
55
00:03:20,180 --> 00:03:24,740
So inside of this class called app component I'm going to give myself a little bit of space at the very
56
00:03:24,740 --> 00:03:34,490
top and I'm going to put in to instance variable declarations mean to say text woollen string then translated
57
00:03:34,640 --> 00:03:37,230
text open string.
58
00:03:37,400 --> 00:03:41,260
Make sure that you've got a colon in between both these little declarations.
59
00:03:41,260 --> 00:03:45,560
You should not have an equal sign anywhere inside there next up.
60
00:03:45,570 --> 00:03:50,070
Right underneath the constructor I can give myself a little bit more space and I'm going to add in a
61
00:03:50,070 --> 00:03:55,270
method called submit then inside the submit method.
62
00:03:55,290 --> 00:04:00,330
We're going to call a translation service that's going to take whatever text got entered by the user
63
00:04:00,570 --> 00:04:09,000
and turn it into Spanish automatically we're going to write out this dot translate service translate
64
00:04:10,250 --> 00:04:18,260
I'm going to pass in this dot text then chain on a little method call you subscribe
65
00:04:20,740 --> 00:04:27,770
into subscribe which is a function as well I'm going to pass in a callback function that callback function.
66
00:04:27,780 --> 00:04:32,430
So notice I've got an arrow function inside of here is going to be called with something that we will
67
00:04:32,430 --> 00:04:42,840
refer to as results and then inside of the callback function we'll say this dot translated text equals
68
00:04:42,960 --> 00:04:49,310
results and this little bit of code right here is kind of complicated so double check your spelling
69
00:04:49,370 --> 00:04:54,200
make sure you've got the same syntax as what I have if you're seeing any air right now I can guarantee
70
00:04:54,200 --> 00:04:58,820
you that the air is coming from something going wrong either in the block of code that we just added
71
00:04:58,820 --> 00:05:05,510
right here or at the block of code to be added right here once you've added that all in let's say this
72
00:05:05,510 --> 00:05:14,440
file can go to File Save going to open up my folder Explorer on the left hand side again this time we're
73
00:05:14,440 --> 00:05:20,690
going to open up the app component that each team will file inside of here.
74
00:05:20,700 --> 00:05:22,160
You're going to see a little div.
75
00:05:22,200 --> 00:05:26,100
And as you would guess the div right here is what we see on the preview window on the far right hand
76
00:05:26,100 --> 00:05:31,350
side we're going to replace this div right here with a little bit of markup that's going to show the
77
00:05:31,350 --> 00:05:38,400
actual form and some content the user gonna highlight that div and delete it.
78
00:05:38,610 --> 00:05:42,730
I'm gonna put together some each team l that's going to essentially show this kind of stuff right here.
79
00:05:42,730 --> 00:05:52,360
So probably a label a text input a button and so on they'll place a label in here that says enter English
80
00:05:54,020 --> 00:05:57,590
a place and input it has a class of input.
81
00:05:57,590 --> 00:06:02,060
Now the only reason I'm adding in that class right there is to just get a little bit of styling and
82
00:06:02,060 --> 00:06:04,910
here's gonna be just a little bit of strange syntax.
83
00:06:04,910 --> 00:06:09,380
Again we're going to discuss all this stuff very shortly so bear with me for just a moment right after
84
00:06:09,380 --> 00:06:10,080
that class.
85
00:06:10,100 --> 00:06:13,790
We're gonna put in a set of parentheses inside of it.
86
00:06:13,790 --> 00:06:23,630
We're gonna put the word input then outside of the parentheses we'll say equals double quotes X equals
87
00:06:24,530 --> 00:06:33,460
dollar sign event target not value and then outside those double quotes are going to close off that
88
00:06:33,460 --> 00:06:39,060
input element like so.
89
00:06:39,110 --> 00:06:43,340
All right just a little bit more right after the button elements or seeing the input element I'm going
90
00:06:43,340 --> 00:06:49,130
to place a button with the class of button and once again we're going to use a little bit of strange
91
00:06:49,130 --> 00:06:52,160
syntax like we just had up there on the input element.
92
00:06:52,280 --> 00:06:56,480
I'll put inside of a set of parentheses the word click equals.
93
00:06:56,730 --> 00:07:02,140
And again with double quotes submit I'm going to put some parentheses after submit as though I were
94
00:07:02,140 --> 00:07:09,040
calling it like a function I'll then close off the button element and put some text inside of it it
95
00:07:09,040 --> 00:07:17,740
says about translate like so and finally underneath all that I'm going to show in each one and this
96
00:07:17,740 --> 00:07:24,370
is where we're going to display the translated Spanish text inside this H1 I'm going to put in two sets
97
00:07:24,430 --> 00:07:26,150
of curly braces.
98
00:07:26,170 --> 00:07:35,290
Notice I've got two opening and two closing in inside of that I'll say translated XT.
99
00:07:35,430 --> 00:07:35,700
All right.
100
00:07:35,730 --> 00:07:36,900
So believe it or not that is it.
101
00:07:36,910 --> 00:07:40,600
That is all the code we have to write to implement this very simple application.
102
00:07:40,600 --> 00:07:44,830
I'm going to say for probably the fourth time inside this video I know a lot of what we just wrote is
103
00:07:44,830 --> 00:07:48,420
pretty crazy but we're going to discuss exactly what we did in just a moment right now.
104
00:07:48,460 --> 00:07:52,180
Let's make sure that our application actually works inside this form.
105
00:07:52,180 --> 00:07:59,020
I can type in our you translate and I get a result right here in Spanish.
106
00:07:59,320 --> 00:08:08,050
I can do any type of English phrase I want like I am going to learn angular translate and there we go.
107
00:08:08,100 --> 00:08:12,430
Now if you don't see a result like this I can guarantee you that you've got a typo either inside of
108
00:08:12,430 --> 00:08:19,010
this app component of each email file or inside the app component dot t s file one of the two a 100
109
00:08:19,030 --> 00:08:25,480
percent guarantee that the app is not working there is a typo in one of the two files if you can't find
110
00:08:25,480 --> 00:08:27,180
that typo that is totally fine.
111
00:08:27,190 --> 00:08:32,740
Hop over to the Q A attached to this lecture so there's a Q A Discussion section and just post your
112
00:08:32,740 --> 00:08:37,950
code out of these two files over there and I'll help you figure out exactly what is going wrong.
113
00:08:38,010 --> 00:08:38,210
All right.
114
00:08:38,220 --> 00:08:39,550
So this is a fun little application.
115
00:08:39,570 --> 00:08:43,410
So as I've mentioned four times now let's take a quick pause we're gonna come back the next video and
116
00:08:43,410 --> 00:08:48,030
discuss all the code that we just put together and get a big overview on angular in general.
13194
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.