The NgContent Directive

We'll learn how to load content in a child component from a parent component.

We'll cover the following

The app is fully navigable. Next, we’ll create some base components. Base components are generic components that we’ll most likely use more than once. It’s common to develop base components for things like buttons, alerts, forms, etc.

We’ll create a base component for an alert box. Bootstrap comes with a set of classes for an alert box. You can find more information here.

Base module

We’ll create a module that will house all our base components. This way, we can import them into any module that needs them. In the command line, run the following command:

ng generate module base

We aren’t adding the --routing option because this will be a module that won’t be tied to a specific resource.

Alert component

Next, we’ll create an alert component. In the command line, run the following command:

ng generate component base/alert

The base module will need to be updated to export the component.

Get hands-on with 1400+ tech skills courses.