A Series of Web Components that you can create in Angular and avoid having to import a whole library for it. In this post I’ll be creating a simple wizard stepper for your Angular Web Apps and PWAs (Progressive Web Apps), just using “vanilla” Angular components and services in a way you can consolidate your views while delivering great user experiences.
_Dependencies: _Angular CLI
Let’s build us ourselves a cool, simple and flexible wizard stepper component in Angular while at the same time we learn some important concepts about:
Let’s start!
Go ahead and create the project via the Angular CLI by using the command
ng new simple-wizard-stepper
Select YES on adding Angular Routing and pick SCSS as your stylesheet format at the prompts provided during project creation.
I’m gonna be using a slick Google Font for this project and also I’ll be using some Material Icons for Web by referencing them from a CDN. Place the links below inside of the tag of the project’s index.html. We’ll show how to use them later.
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Alata&display=swap" rel="stylesheet">
Your app’s main index.html should look like this:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Angular</title>
<base href="/" />
<link
href="https://fonts.googleapis.com/css2?family=Pacifico&display=swap"
rel="stylesheet"
/>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" type="image/x-icon" href="favicon.ico" />
</head>
<body>
<app-root></app-root>
</body>
</html>
At the root of the project, inside the src/app folder, I’ll be creating several directories for better project structure. I’ll create directories called components, models, pages and services. Your structure should look as follows (from the src root):
- src
- app
- components
- models
- pages
- services
#observables #angular #flexbox #services #behaviorsubject