Instructor: We run ngGenerateModuleUI and pass in --module app. We see that the module gets generated and imported by our app module. Now inside this module, we're going to create three components to build out our UI -- the layout, header, and footer components.
Let's open our app routing module to add our first route. This is an object literal with the path property set to an empty string and the component property references layout component. We now see that our app renders the layout components.
We open appComponent.ts and remove everything from the styles array and the template property, except the router outlet element. We open our layout component and add our app header to the template.
Next, we add a div with the class container, MB5 and PB5 to add some spacing. Inside the div, we add the router outlet component. Lastly, we add an app footer.
When we save the page, we see that TypeScript got mad at us. It tells us that router outlet is not a known element. In order to fix this, we open UI module and add router module to the import array. Let's quickly head over to Angular IO/press kit to download the Angular logo in SVG, and store it in our folder source assets, with the name logo.svg.
Now that we have the logo, we open header component, and add three properties in the component class button. Logo, set to assets/logo.svg, title, set to store, and our links, set to an array with one entry, the property labeled product, and the URL set to /products.
We clear out the template, and start by adding a nav tag with the class as navbar, navbar.expand, navbar dark, BG dark, and fixed top. Inside our nav element, we add an a tag with the class navbar that's brand. We change the href property to a router link and set its value to a forward slash.
The content of the a tag will be an image, with the property hdr.src set to logo, hdr.alt set to title, and width and height set to 30. After the image, we add a title property in double curly braces.
Below our a tag, we'll create a div with the class as collapse and navbar collapse. Inside this div, we add another div with the navbar-nav class.
Lastly, we add an a tag with the nav item and nav link classes. We use the ngFor directive on the a tag to loop over the items in our links array. Content of the a tag is set to link.label, double curly braces, and we add a router link directive in square brackets, and set its value to linked URL.
We set router link active to active, then we add the router link active options in square brackets, and assign the value to an object with the key exact set to true. We open the footer component, and clear the content of the template.
We add a nav tag with the class as navbar, navbar expands, navbar dark, BG dark, and fixed bottom. Inside our nav element, we add a div tag with the class as set to navbar text, -auto to center the content, and text white for some better contrast. Inside our div, we place our footer tag -- just a simple copyright message.