๐ Structural Directive
Challenge #6
Information
Structural directive is an important concept you will need to master to improve your angular skills and knowledge. This will be the first part of this challenge.
Guard is also very important since you will always need it in every application you build.
Statement
In LoginComponent, you will find 6 buttons corresponding to 6 differents userโs role.
- Admin
- Manager
- Reader
- Writer
- Reader and Writer
- Client
- Everyone
Step 1
In InformationComponent
, you need to display the correct piece of information for each role using a structural directive.
Constraints
- no
ngIf
or@if
insideInformationComponent
- importing the store inside
InformationComponent
is not allowed.
You should end up with something like below:
<div *hasRole="Role1">Info for Role1</div>
<div *hasRole="['Role1', 'Role2']">Info for Role1 and Role2</div>
<div *hasRoleSuperAdmin="true">Info Only for superadmin</div>
Step 2
In Routes.ts
, you should route all users to the correct DashboardComponent
using CanMatch
guard.