Component communication
This section will dive deep into component communication, starting with input and output decorators. Before we begin, let’s create a new component with the Nx generator so that we have something to work with.
Name your new component navbar
and add it to the shared-ui-common-components
library. Don’t forget to check the standalone
checkbox and select OnPush
for changeDetection
. When the component has been created, add it to the index.ts
area of your library:
export * from './lib/navbar/navbar.component';
After that, add the navbar
component to the app.component.html
file of your expenses-registration
application. It’s important to note that you need to add the NavBarComponent
class to the imports
array of your app
component decorator. This is because we are using standalone components, and a standalone component needs to import everything it uses. Once you’ve added the navbar
component to the template of your app...