Build your first AngularJS Web App Project

In this tutorial we’re going to take a look at AngularJS, which is one of the amazing front-end developer framework. By starting this we need to know what AngularJS is and how it can help us build applications faster and more efficient.

What you should know?
In order for us to use some of the features, we need to have the following:

  • A server and a good understanding of working with web projects
  • Basic of HTML
  • how to work with the file system
  • some knowledge of JavaScript

If you need help with basic HTML, take a look at HTML Training courses online. There are a lot of online courses about HTML for your reference.

In this course, I’m also using the bootstrap framework for some of the page code. Check out the Bootstrap 4 as I will be using the version 4 of the framework for this tutorial.

What is AngularJS?
AngularJS is simply a framework that makes it easier to build single-page web applications. A framework is simply a way to structure your programs so if we write code using the framework, it makes it easier to build complex functionality. 

AngularJS uses a Model-View-Controller structure for its framework and although you can organize it in different ways, this is the main way that you think of things in AngularJS. When we talk about the model, we simply mean the data. The view means a template system that helps us add Angular code into our HTML pages. Finally, the Controller is what we call the JavaScript that links the data to the templates. Although AngularJS’s structure can be configured in different ways, it’s this MVC structure that is the most common approach.

Without further ado let’s build a simple Directory Search Project

Take a look at the file structure:

Your index.html under /builds/angular folder

<!DOCTYPE html>
<html ng-app="myApp">
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">

  <link rel="stylesheet" href="lib/bootstrap/bootstrap.min.css">
  <link rel="stylesheet" href="css/style.css">

  <script src="lib/angular/angular.min.js"></script>
  <script src="lib/angular/angular-route.min.js"></script>

  <script src="js/app.js"></script>
  <script src="js/controllers.js"></script>
<body class="bg-secondary">

<div ng-view></div>
<script src="lib/jquery/jquery.min.js"></script>
<script src="lib/bootstrap/popper.min.js"></script>
<script src="lib/bootstrap/bootstrap.min.js"></script>


In your library folder maker sure you have included the angular, bootstrap and jquery min files

Now for your CSS, copy and paste this under /builds/angular/css/style.css

body {
  font-weight: 100;

h1, h2, h3, h4, h5, h6, p, input {
  font-weight: 100;

.artist-list {
  line-height: 100%;  

.artist-list .list-group-item {
  padding: .3rem 1.5rem;

.artist-list .list-group-item:first-child {
  border-top: none;
  border-radius: 0;

.artist-list .list-group-item img {
  width: 70px;

.artist-list .list-group-item:hover {
  background-color: #f8f9fa;

.artist-list a {
  text-decoration: none;

Now for your code under the js folder, I created a subfolder named partials which will be used for the details and search HTML layout.


var myApp = angular.module('myApp', [

myApp.config(['$routeProvider', function($routeProvider) {
    .when('/', {
      templateUrl: 'js/partials/search.html',
      controller: 'SearchController'
    .when('/details/:itemId', {
      templateUrl: 'js/partials/details.html',
      controller: 'DetailsController'


var myControllers = angular.module('myControllers', []);

  function MyController($scope, $http) {
    $http.get('js/data.json').then(function(response) {
      $scope.artists =;
      $scope.artistOrder = 'name';

function MyController($scope, $http, $routeParams) {
  $http.get('js/data.json').then(function(response) {
    $scope.artists =;
    $scope.whichItem = $routeParams.itemId;

    if ($routeParams.itemId > 0) {
      $scope.prevItem = Number($routeParams.itemId) - 1;
    } else {
      $scope.prevItem = $scope.artists.length - 1;

    if ($routeParams.itemId < $scope.artists.length-1) {
      $scope.nextItem = Number($routeParams.itemId) + 1;
    } else {
      $scope.nextItem = 0;



    "name":"Barot Bellingham",
    "reknown":"Royal Academy of Painting and Sculpture",
    "bio":"Barot has just finished his final year at The Royal Academy of Painting and Sculpture, where he excelled in glass etching paintings and portraiture. Hailed as one of the most diverse artists of his generation, Barot is equally as skilled with watercolors as he is with oils, and is just as well-balanced in different subject areas. Barot's collection entitled \"The Un-Collection\" will adorn the walls of Gilbert Hall, depicting his range of skills and sensibilities - all of them, uniquely Barot, yet undeniably different"
    "name":"Jonathan G. Ferrar II",
    "reknown":"Artist to Watch in 2012",
    "bio":"The Artist to Watch in 2012 by the London Review, Johnathan has already sold one of the highest priced-commissions paid to an art student, ever on record. The piece, entitled Gratitude Resort, a work in oil and mixed media, was sold for $750,000 and Jonathan donated all the proceeds to Art for Peace, an organization that provides college art scholarships for creative children in developing nations"
    "name":"Hillary Hewitt Goldwynn-Post",
    "reknown":"New York University",
    "bio":"Hillary is a sophomore art sculpture student at New York University, and has already won all the major international prizes for new sculptors, including the Divinity Circle, the International Sculptor's Medal, and the Academy of Paris Award. Hillary's CAC exhibit features 25 abstract watercolor paintings that contain only water images including waves, deep sea, and river."
    "name":"Hassum Harrod",
    "reknown":"Art College in New Dehli",
    "bio":"The Art College in New Dehli has sponsored Hassum on scholarship for his entire undergraduate career at the university, seeing great promise in his contemporary paintings of landscapes - that use equal parts muted and vibrant tones, and are almost a contradiction in art. Hassum will be speaking on \"The use and absence of color in modern art\" during Thursday's agenda."
    "name":"Jennifer Jerome",
    "reknown":"New Orleans, LA",
    "bio":"A native of New Orleans, much of Jennifer's work has centered around abstract images that depict flooding and rebuilding, having grown up as a teenager in the post-flood years. Despite the sadness of devastation and lives lost, Jennifer's work also depicts the hope and togetherness of a community that has persevered. Jennifer's exhibit will be discussed during Tuesday's Water in Art theme."
    "name":"LaVonne L. LaRue",
    "reknown":"Chicago, IL",
    "bio":"LaVonne's giant-sized paintings all around Chicago tell the story of love, nature, and conservation - themes that are central to her heart. LaVonne will share her love and skill of graffiti art on Monday's schedule, as she starts the painting of a 20-foot high wall in the Rousseau Room of Hotel Contempo in front of a standing-room only audience in Art in Unexpected Places."
    "name":"Constance Olivia Smith",
    "reknown":"Fullerton-Brighton-Norwell Award",
    "bio":"Constance received the Fullerton-Brighton-Norwell Award for Modern Art for her mixed-media image of a tree of life, with jewel-adorned branches depicting the arms of humanity, and precious gemstone-decorated leaves representing the spouting buds of togetherness. The daughter of a New York jeweler, Constance has been salvaging the discarded remnants of her father's jewelry-making since she was five years old, and won the New York State Fair grand prize at the age of 8 years old for a gem-adorned painting of the Manhattan Bridge."
    "name":"Riley Rudolph Rewington",
    "reknown":"Roux Academy of Art, Media, and Design",
    "bio":"A first-year student at the Roux Academy of Art, Media, and Design, Riley is already changing the face of modern art at the university. Riley's exquisite abstract pieces have no intention of ever being understood, but instead beg the viewer to dream, create, pretend, and envision with their mind's eye. Riley will be speaking on the \"Art of Abstract\" during Thursday's schedule"
    "name":"Xhou Ta",
    "reknown":"China International Art University",
    "bio":"A senior at the China International Art University, Xhou has become well-known for his miniature sculptures, often the size of a rice granule, that are displayed by rear projection of microscope images on canvas. Xhou will discuss the art and science behind his incredibly detailed works of art."


<div class="container">
    <div class="row">
      <div class="col-12 mt-3">
          <div class="card">
            <div class="card-header d-flex align-items-start justify-content-between">
              <h1 class="card-title my-0">{{artists[whichItem].name}}</h1>
              <nav class="btn-group">
                <a class="btn btn-sm btn-secondary" 
                <a class="btn btn-sm btn-secondary" 
                <a class="btn btn-sm btn-secondary" 
            <div class="card-body"
              <h4 class="card-title text-dark mt-0">{{artists[whichItem].reknown}}</h4>
              <img class="float-left mr-2 rounded"
                alt="Photo of {{artists[whichItem].name}}">
              <div class="card-text text-secondary">{{artists[whichItem].bio}}</div>


<div class="container mt-sm-3">
    <div class="row justify-content-center">
      <div class="col-12 col-md-8 col-lg-6 card">
          <div class="card-body">
            <h2 class="card-title text-dark">Artist Directory</h2>

              <div class="form-row mb-2">
                <div class="col">
                  <label class="col-form-label text-right" for="searchQuery">
                    search <span ng-if="query">{{ 'for: ' + query }}</span></label>
                </div><!-- label -->
                <div class="col-12">
                  <input class="form-control form-control-lg" id="searchQuery" placeholder="Search for artists" autofocus
                </div><!-- col-12 -->
              </div><!-- form-row -->

              <div class="form-row">
                  <div class="col">
                    <select class="form-control form-control-inline mr-3 w-100"
                      <option value="name">Name</option>
                      <option value="reknown">Reknown</option>
                  </div><!-- col -->
                  <div class="col-5 col-md-4">
                    <div class="form-check form-check-inline">
                      <label class="form-check-label"><input class="form-check-input" type="radio" name="direction" checked
                        ng-model="direction"> asc</label>
                    </div><!-- form-check -->
                    <div class="form-check form-check-inline">
                      <label class="form-check-label">
                        <input class="form-check-input" type="radio" name="direction" value="reverse"
                        ng-model="direction"> desc</label>
                    </div><!-- form-check -->
                  </div><!-- col-5 -->
                </div><!-- form-row -->

          </div><!-- card-body -->
      </div><!-- col-12 -->
    </div><!-- row -->
</div><!-- col-container -->

<div class="artist-list container" ng-if="query">
    <div class="row justify-content-center">
      <div class="col-12 col-sm-9 col-md-7 col-lg-5">
        <ul class=" list-group d-flex">
          <li class="list-group-item" 
          ng-repeat="item in artists | filter: query |
              <a href="#/details/{{artists.indexOf(item)}}">
              <div class="media d-flex align-items-center">
                <img class="rounded-circle mr-3"
                  alt="Photo of {{}}">
                <div class="media-body">
                  <h5 class="my-0 text-dark">{{}}</h5>
                  <div class="text-secondary font-italic">{{item.reknown}}</div>
                </div><!-- media-body -->
              </div><!-- media -->
      </div><!-- col-12 -->
    </div><!-- row -->
  </div><!-- col-container -->

For more question follow this link for a complete guide and more amazing tutorials.