All language subtitles for 7. Angular vs JavaScript Design Patterns6

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French Download
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranî)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:00,740 --> 00:00:04,700 Now seeing three different ways of handling data inside of angular templates. 2 00:00:04,850 --> 00:00:09,080 Now we're gonna start to take those ideas and apply them to our application and finish it up. 3 00:00:09,110 --> 00:00:13,190 In this video I want to give you a quick overview of some of the design patterns so we're going to use 4 00:00:13,190 --> 00:00:17,150 inside this application using those three different techniques. 5 00:00:17,160 --> 00:00:19,190 Okay so quick diagram the first one. 6 00:00:19,200 --> 00:00:24,660 Think about how we would tackle this application if we were using a traditional javascript only approach. 7 00:00:24,660 --> 00:00:29,570 So in other words if we were just working with vanilla javascript if that was the case you would probably 8 00:00:29,570 --> 00:00:34,790 have a user enter a password length the user would then select from checkbox like maybe in this case 9 00:00:34,820 --> 00:00:40,280 include letters and then they would click on the Generate button and then in the javascript only approach 10 00:00:40,340 --> 00:00:45,980 we would probably then run some code to take a look at that password length input and pull the value 11 00:00:45,980 --> 00:00:51,740 out of it and pull the value of the three checkboxes generate random password and then throw the password 12 00:00:51,740 --> 00:00:53,240 into the output input. 13 00:00:53,270 --> 00:00:55,480 I know that's a confusing phrase right there. 14 00:00:55,480 --> 00:00:58,480 I'm really just talking about this text and put down here at the very bottom. 15 00:01:00,510 --> 00:01:04,270 Again this is the kind of approach you would take if you were writing normal javascript code. 16 00:01:04,350 --> 00:01:08,400 Let's now compare that to how we're going to approach this with angular using those three different 17 00:01:08,400 --> 00:01:10,350 pieces of syntax. 18 00:01:10,410 --> 00:01:15,900 So here's the kind of angular approach so singular we're going to have a user entered a password link 19 00:01:16,440 --> 00:01:18,900 as soon as they type something inside that text input. 20 00:01:18,960 --> 00:01:21,420 We're going to run an event handler. 21 00:01:21,420 --> 00:01:23,920 We're gonna set up an event handler on that text input. 22 00:01:24,690 --> 00:01:29,730 Once that event handlers triggered we're going to take the value from that input and stored as a property 23 00:01:30,060 --> 00:01:35,370 on our component class instance we're then going to repeat that same idea. 24 00:01:35,460 --> 00:01:39,730 Those three different checkboxes and then eventually the user is going to click on the Generate button 25 00:01:40,500 --> 00:01:45,100 when they click on that generic button that is once again going to trigger an event handler. 26 00:01:45,100 --> 00:01:50,770 So inside that event handler we're going to generate our password using all the properties we had collected 27 00:01:50,800 --> 00:01:57,240 earlier like up here when we got the different checkboxes and the password like that that point time. 28 00:01:57,240 --> 00:02:01,950 We're then going to take the generated password assign it to a password property again on the component 29 00:02:01,950 --> 00:02:06,780 class instance and that is going to cause an update of the output input. 30 00:02:06,780 --> 00:02:10,560 This last step down here is very similar to the behavior we have right now where we click on the button 31 00:02:10,830 --> 00:02:17,960 and then we see a value up here inside there their let's do a compare and contrast of this kind of JavaScript 32 00:02:17,960 --> 00:02:23,540 style approach and the angular style approach and really understand what is different about them. 33 00:02:23,580 --> 00:02:23,870 OK. 34 00:02:23,900 --> 00:02:27,500 So in this diagram I know it's kind of small text and probably hard to read but we're only going to 35 00:02:27,500 --> 00:02:32,360 look at it for a moment to the really important thing that I want to point out about angular that is 36 00:02:32,360 --> 00:02:34,310 very different than traditional javascript. 37 00:02:34,420 --> 00:02:35,960 Is that in a javascript world. 38 00:02:36,050 --> 00:02:41,300 We wait for a user to undertake some action like say clicking on that generate button and then immediately 39 00:02:41,300 --> 00:02:46,490 after it we go ahead and try to pull some data out of the Dom to do our actual calculation. 40 00:02:46,690 --> 00:02:51,970 So it's then in other words kind of like user action then we spring into action and collect some data. 41 00:02:52,400 --> 00:02:55,530 But in the end of the world we have a very different style. 42 00:02:55,670 --> 00:03:00,740 As soon as the user starts entering data we start to read all that information right away and store 43 00:03:00,740 --> 00:03:03,410 it on a component class instance. 44 00:03:03,410 --> 00:03:08,150 Then whenever a user clicks on the Generate button we've already got all the data in hand that we need 45 00:03:09,840 --> 00:03:14,960 that we'll do some final computation and then stick a final value back into the Dom. 46 00:03:15,050 --> 00:03:19,980 That's a big difference between the traditional javascript approach and the angular approach. 47 00:03:20,240 --> 00:03:23,900 Now that we understand the big difference between these two let's really focus on what we have to do 48 00:03:23,900 --> 00:03:24,830 right now. 49 00:03:24,950 --> 00:03:29,390 They're essentially saying that for all these different form inputs we're going to have to put together 50 00:03:29,600 --> 00:03:34,560 an event handler to detect a change of say that password length input. 51 00:03:34,580 --> 00:03:39,800 And we're also going to have to have a property on our component class instance that we can save whatever 52 00:03:39,800 --> 00:03:45,290 the user entered and make use of it later on when the user clicks the Generate button thing for the 53 00:03:45,290 --> 00:03:46,490 checkbox as well. 54 00:03:46,580 --> 00:03:50,780 We need to make sure that we've got an event handler on the checkbox we need to make sure that we've 55 00:03:50,780 --> 00:03:56,630 got a property on our component class instance that we can store that property value and then use it 56 00:03:56,630 --> 00:03:59,970 later on when the user clicks on generates. 57 00:03:59,970 --> 00:04:00,230 All right. 58 00:04:00,240 --> 00:04:04,800 So that's the general idea here and we're going to be repeating the same pattern over and over and over 59 00:04:04,800 --> 00:04:09,920 again for all of our angular applications that we've got a good idea of what's going on. 60 00:04:09,920 --> 00:04:11,970 Well let's start to implement this in the next video. 7029

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.