All language subtitles for 16. Host Element Selectors3

af Afrikaans
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bn Bengali
bs Bosnian
bg Bulgarian
ca Catalan
ceb Cebuano
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
tl Filipino
fi Finnish
fr French Download
fy Frisian
gl Galician
ka Georgian
de German
el Greek
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
km Khmer
ko Korean
ku Kurdish (Kurmanji)
ky Kyrgyz
lo Lao
la Latin
lv Latvian
lt Lithuanian
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mn Mongolian
my Myanmar (Burmese)
ne Nepali
no Norwegian
ps Pashto
fa Persian
pl Polish
pt Portuguese
pa Punjabi
ro Romanian
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
st Sesotho
sn Shona
sd Sindhi
si Sinhala
sk Slovak
sl Slovenian
so Somali
es Spanish
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
te Telugu
th Thai
tr Turkish
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
or Odia (Oriya)
rw Kinyarwanda
tk Turkmen
tt Tatar
ug Uyghur
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:01,140 --> 00:00:03,040 Well our application is just about complete. 2 00:00:03,060 --> 00:00:08,040 But if we go back and look at our original mockup notice how the mockup shows all of our different cards 3 00:00:08,070 --> 00:00:10,630 spanning from left to right inside of our application. 4 00:00:10,650 --> 00:00:15,060 They're going vertically in this video I just want to add in a little bit of custom CSX to make sure 5 00:00:15,060 --> 00:00:19,770 that these cards span left to right now in order to do this you can have to understand a little bit 6 00:00:19,770 --> 00:00:23,910 more about how angular handles CSX in particular we need to understand. 7 00:00:23,910 --> 00:00:28,370 One real small corner case that you really need to be aware of. 8 00:00:29,370 --> 00:00:34,640 To help you understand how to style the stuff going to first just show you directly what CSX rule we're 9 00:00:34,630 --> 00:00:38,200 going to apply to which element inside the browser. 10 00:00:38,200 --> 00:00:42,050 Once we understand what role we're going to apply and which element we're going to apply it to. 11 00:00:42,130 --> 00:00:47,530 Well then go back over to our Ed and we'll figure out how to essentially translate the CSX into the 12 00:00:47,530 --> 00:00:49,270 angular world. 13 00:00:49,280 --> 00:00:49,490 OK. 14 00:00:49,510 --> 00:00:55,020 So I got it right click anywhere on the screen and hit inspect all then pull up my element inspector 15 00:00:56,260 --> 00:01:00,520 and then inside of here if we look at our H html structure we'll see that we've got the body inside 16 00:01:00,520 --> 00:01:06,440 there is our app dash root element the abduction element remember that represents our app components. 17 00:01:06,670 --> 00:01:12,620 We refer to this as our host component or submit our host element or the app components though in other 18 00:01:12,620 --> 00:01:17,270 words when our angular builds out our entire application and renders it on the screen it's going to 19 00:01:17,270 --> 00:01:24,180 find that app root element it's going to look up the app component it's gonna create a new instance 20 00:01:24,330 --> 00:01:25,490 of this class. 21 00:01:25,740 --> 00:01:30,600 It's going to take its accompanying template that's going to take everything inside of here and throw 22 00:01:30,600 --> 00:01:33,070 it into that host elements. 23 00:01:33,130 --> 00:01:38,610 And so inside of app root if we expand that we'll see five copies of the app cars and use it for copies. 24 00:01:38,630 --> 00:01:44,360 Yeah we've only got four copies right now of the app Card element that we wanted to make sure that these 25 00:01:44,360 --> 00:01:46,140 things run themselves from left to right. 26 00:01:46,160 --> 00:01:50,070 We would find that app dash route element I would select it. 27 00:01:50,290 --> 00:01:56,870 I could then open up the CSF panel right here and inside of element dot style I'll add in a manual style. 28 00:01:56,870 --> 00:02:04,910 So I'm going to say display and I'll hit tab to set the value is flex so as as soon as I do so I'll 29 00:02:04,910 --> 00:02:07,690 now see my card span from left to right. 30 00:02:07,700 --> 00:02:12,890 That's how we just get our cards to spend left or right we just apply the display of flex to the app 31 00:02:12,890 --> 00:02:14,130 root element. 32 00:02:14,240 --> 00:02:15,370 So that's simple enough. 33 00:02:15,500 --> 00:02:19,760 Right now we need to figure out how to go back over to our project we need to figure out where to add 34 00:02:19,760 --> 00:02:22,610 this new styling to okay. 35 00:02:22,650 --> 00:02:28,410 So back over here there are now three locations where we can add some CSF to inside of our project. 36 00:02:28,410 --> 00:02:31,850 The first is styles Dot's USS. 37 00:02:31,980 --> 00:02:37,330 Now remember this file's all about global styles right now we are not trying to add in a global style 38 00:02:37,330 --> 00:02:41,750 that's going to be applied to an entire class of elements inside of application. 39 00:02:41,800 --> 00:02:45,980 Instead we want to apply a style to a very specific element. 40 00:02:46,210 --> 00:02:52,090 But I think that adding that style to styles Nazi SS is not appropriate but instead we're going to find 41 00:02:52,150 --> 00:02:57,850 our apt component Nazi SS file it would be more appropriate to apply some styling inside of here because 42 00:02:57,940 --> 00:03:03,160 this Yes s file is going to affect our app component alone and that's really what we're trying to do 43 00:03:03,160 --> 00:03:03,760 right now. 44 00:03:03,850 --> 00:03:06,940 We just want to effect the app components. 45 00:03:06,960 --> 00:03:11,020 Now here's the question how do we select the app. 46 00:03:11,080 --> 00:03:11,590 Dash. 47 00:03:11,630 --> 00:03:12,280 Root element. 48 00:03:13,090 --> 00:03:15,250 Well to select that element right there. 49 00:03:15,400 --> 00:03:20,680 Let's use some common sense like Let's write a selector that's gonna look for an element called app 50 00:03:20,710 --> 00:03:22,270 dash route. 51 00:03:22,510 --> 00:03:23,650 So I'm going to go back over. 52 00:03:23,650 --> 00:03:30,370 I'm going to put in a selector of app dash route and I'll give it a display of flex. 53 00:03:30,370 --> 00:03:33,210 This right here this is like a common sense approach right. 54 00:03:33,220 --> 00:03:35,880 We write out the sector and we write the rule inside. 55 00:03:36,010 --> 00:03:36,970 Let's save this. 56 00:03:36,970 --> 00:03:39,220 Pull it back over and see if it worked. 57 00:03:39,280 --> 00:03:41,130 I'll flip back over and sure enough. 58 00:03:41,130 --> 00:03:46,570 Nope it didn't work my application reloaded and so I lost that manual style I applied and if I slept 59 00:03:46,600 --> 00:03:51,310 at dash routes I will very plainly see that the element that we just tried to style we didn't get that 60 00:03:51,310 --> 00:03:52,030 rule at all. 61 00:03:52,030 --> 00:03:57,610 The element or the style not showing up inside of here so you might think that using the app dash route 62 00:03:57,610 --> 00:04:00,730 selector to find the app root element doesn't work. 63 00:04:00,730 --> 00:04:02,610 That is not quite the case. 64 00:04:02,650 --> 00:04:04,940 Let me show you something kind of interesting. 65 00:04:05,140 --> 00:04:11,040 If I take this real right here and cut it and go back over to styles dots CSX. 66 00:04:11,070 --> 00:04:13,410 So remember this is the global style file. 67 00:04:13,410 --> 00:04:18,780 If I now paste that selector and the rule inside of here and save the file now I will see everything 68 00:04:18,780 --> 00:04:20,220 laid out correctly. 69 00:04:20,280 --> 00:04:21,780 So what does this tell us. 70 00:04:21,780 --> 00:04:25,730 Well it tells us that the app dash route selector works. 71 00:04:25,770 --> 00:04:31,740 We can use that to select the app root element but we can't use the app route selector inside of the 72 00:04:31,740 --> 00:04:32,550 app components. 73 00:04:32,550 --> 00:04:37,020 Yes that's file though at the very start this video I mentioned that there's a big gotcha here. 74 00:04:37,020 --> 00:04:43,000 So let me just get to the point and tell you what the gotcha is we spoke earlier about how a components 75 00:04:43,070 --> 00:04:48,870 SS file can only affect elements that are created inside of that components template file. 76 00:04:49,120 --> 00:04:50,470 That's true. 77 00:04:50,470 --> 00:04:58,600 We can also affect the styling of our host element that is the app root right there but we cannot affect 78 00:04:58,600 --> 00:05:03,580 the host element by writing out the name of the host element directly. 79 00:05:03,580 --> 00:05:08,830 Instead we have to use a very special selector the very special selector we're going to write here is 80 00:05:08,830 --> 00:05:15,980 colon ost that finds our host element of the app component because we are writing this inside the app 81 00:05:15,980 --> 00:05:22,910 component the as file the host element for our app component is app dash route. 82 00:05:23,000 --> 00:05:25,220 That's how we select that element right there. 83 00:05:25,220 --> 00:05:30,750 That's how we select our host element inside of the accompanying components CFS file. 84 00:05:30,980 --> 00:05:35,950 Now on and host inside there we can add our display of flex. 85 00:05:36,130 --> 00:05:40,060 I'm going to go backwards the styles Nazi SS because we still have this one over here. 86 00:05:40,060 --> 00:05:45,410 I'm going to delete that extra one and save both these files. 87 00:05:45,470 --> 00:05:49,680 Now if I go back over to my browser I will see that my cards are now laid out from left to right. 88 00:05:50,510 --> 00:05:56,700 And if I open up my CSX inspector on the app route element I'll see that I did in fact successfully 89 00:05:56,700 --> 00:05:58,950 apply a styling rule from the app components. 90 00:05:58,950 --> 00:06:01,540 Yes as file okay so that's it. 91 00:06:01,540 --> 00:06:06,640 That is the big gotcha I just wanted to be aware of if we ever want to select a host element from inside 92 00:06:06,670 --> 00:06:13,160 of that components the SS file we just have to use the colon host selector really quickly on that element. 93 00:06:13,300 --> 00:06:20,790 I'm going to add on to other roles here and also add on Justified content of space between and a flex 94 00:06:20,790 --> 00:06:28,780 wrap of wrap on and save this if I flip back over I'll see that I now get some nice spacing between 95 00:06:28,780 --> 00:06:33,490 each card and as I start to shrink the screen it's going to automatically collapse and show these cards 96 00:06:33,490 --> 00:06:37,460 on separate lines just a handle mobile devices. 97 00:06:37,480 --> 00:06:37,720 Okay. 98 00:06:37,750 --> 00:06:38,800 Well this looks pretty good. 99 00:06:38,800 --> 00:06:41,280 Let's take a pause right here and do a wrap up in the next video. 10470

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