Read progress

Lockdown is for Our Safety

  • Stay at home 🏡
  • Wash your hands frequently 🧼
  • Maintain social distancing 🤝❌
  • Avoid touching eyes, nose and mouth ☹
More Info
  • Home
  • Blog
  • Build an alarm clock application using Angular | Project Setup - Part 1

Build an alarm clock application using Angular | Project Setup - Part 1

Easy navigation to:

Hi Folks, Sorry for the long wait! Let’s start from where we left.

In this tutorial, we will set up, customize and install the necessary dependencies into our angular project.

Create Project

ng new alarm-clock-angular-tutorial

This command will start the process of creating project. The first thing CLI will ask you is whether to include routing or not. I would say, Yes!

? Would you like to add Angular routing? (y/N) (Type y and Press `Enter`)

Next, it will ask you to choose for stylesheet format. For our tutorial, I will keep things simple, so I am choosing CSS from the list.

In case, you want to try any preprocessors, feel free to choose another option.

? Which stylesheet format would you like to use? (Use arrow keys)
> CSS
  SCSS   [ https://sass-lang.com/documentation/syntax#scss                ]
  Sass   [ https://sass-lang.com/documentation/syntax#the-indented-syntax ]
  Less   [ http://lesscss.org                                             ]
  Stylus [ http://stylus-lang.com                                         ]

That’s it! Now Angular CLI will create necessary files and install the dependencies. Your internet is slow? Go get a coffee till its done.

Installing few other Dependencies

Below is the list of dependencies:

I will be using Bootstrap to reduce my work on CSS and concentrate more on Angular. Navigate to the newly created directory alarm-clock-angular-tutorial and run below command.

Bootstrap is the world’s most popular and most used responsive CSS framework

npm i -S bootstrap

This command will install latest bootstrap(which is 4.3.1 when I wrote this article) into node_modules directory and now is the time to include it in our project.

Open angular.json file and updates styles section as shown below:

"styles": [
    "node_modules/bootstrap/dist/css/bootstrap.min.css",
    "src/styles.css"
],

You want to customize what components to include from Bootstrap? Well, here is the article for you.

Customizing package.json

Update start property under scripts will the example below:

"start": "ng serve -o"

What does it do? Once you run your project, it will open the URL(ex: http://localhost:4200) in the browser automatically.

To know more about Angular CLI commands, visit here.

Test Run

Replace the code in app.component.html with the code below:

<div class="container my-5">
  <div class="row justify-content-center">
    <div class="col-sm-4">
      <div class="card">
        <div class="card-header">
          <h2 class="card-title d-flex justify-content-between align-items-center">
            <span>
              Alarm Clock
              <small class="text-muted text-uppercase d-block" style="font-size:12px;">A small demo by Masoom</small>
            </span>
          </h2>
        </div>
        <div class="card-body">
          <p>Congrats on completing Part 1!</p>
        </div>
      </div>
    </div>
  </div>
</div>

<router-outlet></router-outlet>

and run the below command to serve our project.

npm start

If you see this, Congrats on successfully completing Part 1!

Alarm Clock Part 1 Preview
Alarm Clock Part 1 Preview

Else let me know what went wrong in the comment box.

Useful Angular References

In the next article, let’s make the skeleton ready for our Alarm Clock.

Hope you like this tutorial. Any queries or concerns? Feel free to comment below in the comment box.

Masoom Ul Haq S logo
About author
Masoom Ul Haq S

Masoom is a Front-end Developer, a UX Engineer and Freelancer based in Bangalore, India. Like to develop differential and effective User Experiences for digital products using an amalgamation of latest technology and best practises.

More on "Angular"

Be the first to know about my upcoming writings.

By using our site, you acknowledge that you have read and understand our Privacy Policy.