All language subtitles for 8. Adding Home and NotFound Routes

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic Download
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
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:01,460 --> 00:00:05,260 Our application looks pretty good but there is one or two little remaining issues. 2 00:00:05,450 --> 00:00:10,280 If I go to the address bar right now and delete slash collections and just try to go back to a local 3 00:00:10,280 --> 00:00:16,040 host forty two hundred I get a empty little box right here which is not very pretty. 4 00:00:16,100 --> 00:00:20,300 Be kind of nice if we had some default content to show to the user anytime they come to our landing 5 00:00:20,300 --> 00:00:21,510 page. 6 00:00:21,590 --> 00:00:22,440 One other issue. 7 00:00:22,490 --> 00:00:28,670 If the user goes to any other route like some random gibberish like you see right here we get an error 8 00:00:28,670 --> 00:00:32,110 message and the user sees nothing at all as well. 9 00:00:32,240 --> 00:00:36,530 I want to handle both those scenarios I want to handle the case in which a user goes to our route route 10 00:00:37,810 --> 00:00:43,250 now also want to hold a case in which a user goes to some random wrapped they handle these two cases. 11 00:00:43,280 --> 00:00:45,820 We're going to generate two additional components. 12 00:00:45,920 --> 00:00:50,050 One component is going to be called the home component molded displayed to the user. 13 00:00:50,110 --> 00:00:55,250 Anytime they come to a local host already two hundred will also create a second component called the 14 00:00:55,340 --> 00:01:01,310 not found component that will displace a message to the user that says something like sorry but can't 15 00:01:01,310 --> 00:01:05,220 find the component or the root or that whatever that you're looking for. 16 00:01:05,330 --> 00:01:08,840 Let's go over to our command line and we're gonna generate these two components 17 00:01:11,790 --> 00:01:17,050 inside Mike comps project directory all run energy generate components. 18 00:01:17,190 --> 00:01:25,550 I'll call this first one home and we'll create a second one I'll call it not found you'll notice right 19 00:01:25,550 --> 00:01:31,110 away that when I generated these components I did not tie them to any module inside of my project. 20 00:01:31,160 --> 00:01:36,500 So whenever we have an angular project that uses modules we do not have to specifically place every 21 00:01:36,500 --> 00:01:39,070 component that we make inside of a module. 22 00:01:39,230 --> 00:01:43,370 You can just have some them just free floating if there's no better location for them. 23 00:01:44,100 --> 00:01:49,200 If I go backwards my code editor will now see that inside my app directory I have some folders that 24 00:01:49,200 --> 00:01:56,070 correspond to an actual module and some like home and not found that correspond to normal components. 25 00:01:56,190 --> 00:02:00,960 That is totally fine and you should expect inside this app directory to have some folders that contain 26 00:02:00,960 --> 00:02:06,230 modules and some that contain components if we want to now display these two components. 27 00:02:06,230 --> 00:02:11,150 We just added we would add them to our app routing module. 28 00:02:11,150 --> 00:02:17,150 Remember when we first generated our project we used that energy new command we added on dash dash routing 29 00:02:17,150 --> 00:02:24,200 to the very end that generated our app as usual or the app module but it also added in an app routing 30 00:02:24,200 --> 00:02:28,320 module as well inside this app routing module. 31 00:02:28,350 --> 00:02:34,290 We will add any root configuration that doesn't make sense to place with some other module though in 32 00:02:34,290 --> 00:02:40,050 our scenario we want to display the home component in the not found component and it doesn't really 33 00:02:40,050 --> 00:02:45,480 make a lot of sense to place any routing logic tied to those components inside of any other module. 34 00:02:45,480 --> 00:02:50,700 It makes the most sense to just associate this as some routing information with the app routing module 35 00:02:50,760 --> 00:02:55,580 instead we're going to add in some rules inside this routes array right here. 36 00:02:55,680 --> 00:03:01,650 It will say display either the home component or not found under some given scenario. 37 00:03:01,650 --> 00:03:07,840 Let's first wire up just the home component by itself go inside the app routing module at the very top. 38 00:03:07,840 --> 00:03:17,740 I'm going to import the home component which we just generated from the home lash home doc component 39 00:03:17,860 --> 00:03:22,020 file and inside of this roots array. 40 00:03:22,060 --> 00:03:28,000 I'll say that whenever a user goes to a path of empty string but empty string right there means just 41 00:03:28,160 --> 00:03:33,310 localized already 200 by itself of user ever goes to localized forty two hundred. 42 00:03:33,310 --> 00:03:36,730 I want to show that component Home component 43 00:03:41,800 --> 00:03:43,270 actually before we add in that second one. 44 00:03:43,270 --> 00:03:45,320 Let's do a quick test of just the home component. 45 00:03:45,430 --> 00:03:49,090 So as soon as we add in that cycle 1 we're going to actually see some interesting behavior. 46 00:03:49,190 --> 00:03:54,070 If I now look back over I might look list forty two hundred and I see home works. 47 00:03:54,070 --> 00:03:56,720 I can still go to elements or collections. 48 00:03:56,720 --> 00:04:03,090 It looks like those components work as well let's now try also wiring up the not found components. 49 00:04:03,250 --> 00:04:07,320 The writing out this additional row is gonna be a little bit more challenging because in this scenario 50 00:04:07,620 --> 00:04:13,830 we want to say that if a user goes to any route that we don't understand we want to show the not found 51 00:04:13,830 --> 00:04:16,560 components to get started. 52 00:04:16,590 --> 00:04:29,720 I'll first import the not found component that we just generated from not found not found component. 53 00:04:29,740 --> 00:04:36,240 Now add in a second object inside this array to add in an additional routing rule go inside this object 54 00:04:36,580 --> 00:04:42,490 I'm going to add in a path of Star Star or asterisk asterisk. 55 00:04:42,690 --> 00:04:48,510 This means that if we do not find some other route to display to the user and just show this component 56 00:04:48,930 --> 00:04:50,870 you can really think of this as being like a wild card. 57 00:04:50,880 --> 00:04:54,050 It means no matter what the route is just go ahead and show this component. 58 00:04:55,110 --> 00:04:58,970 All put in component not found component. 59 00:04:59,110 --> 00:05:03,220 I got to tell you right now that as soon as we test this out we're gonna start to see some really strange 60 00:05:03,250 --> 00:05:04,410 behavior. 61 00:05:04,420 --> 00:05:10,780 Let's say this go back over here and see what is going wrong if I know go back over and I go to just 62 00:05:10,840 --> 00:05:14,600 local host forty two hundred I see homeworks. 63 00:05:14,670 --> 00:05:16,300 OK good enough. 64 00:05:16,300 --> 00:05:22,260 If I go to localized forty two point thirty two hundred and then some gibberish I see not found works. 65 00:05:22,450 --> 00:05:22,890 Awesome. 66 00:05:22,900 --> 00:05:24,470 That is what we want. 67 00:05:24,520 --> 00:05:29,960 However if I go to elements I still see not found works. 68 00:05:29,980 --> 00:05:34,410 If I go to collections I also still see not found works. 69 00:05:34,420 --> 00:05:40,120 Right now it appears that are not found component is somehow elbowing the collections or the elements 70 00:05:40,120 --> 00:05:44,890 roots right here out of the way we are accidentally showing them not found component when we should 71 00:05:44,890 --> 00:05:49,300 be showing these collections home where the elements home components. 72 00:05:49,360 --> 00:05:53,740 Let's take a pause right here we can come back the next video and take a look at a diagram to understand 73 00:05:53,770 --> 00:05:57,460 exactly why this is occurring and how we can very easily fix it. 8412

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