AngularJS, Angular-UI Router Hello World Starter App – Code Sample

This article represents code samples to get started with an AngularJS app with Angular UI-Router and Bootstrap. Please feel free to comment/suggest if I missed to mention one or more important points. Also, sorry for the typos.
Code Example – AngularJS 1, Angular UI-Router, Bootstrap

Pay attention to some of the following in the code given below:

  • Angular-UI router state information is used to associate links with templates
  • Angular-UI code with within tag element “ui-view” to load specific views
<!DOCTYPE html>
  <title>My AngularJS App</title>
  <link rel="stylesheet" href="" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<body ng-app="myApp" class="container">
  <div class="page-header">
    <h1>Angular 1 - Angular UI Router</h1>
  <div class="container-fluid">
    <div class="row">
      <div class="col-sm-3 col-lg-2">
        <nav class="navbar navbar-default navbar-fixed-side">
          <ul class="nav nav-pills nav-stacked">
            <li role="presentation"><a ui-sref="about" ui-sref-active="active">UI Router App</a></li>
            <li role="presentation"><a ui-sref="hello" ui-sref-active="active">Say Hello</a></li>
      <div class="col-sm-9 col-lg-10">
  <script src=""></script>
  <script src="//"></script>
    angular.module('myApp', ['ui.router']).
    config(function($stateProvider) {
                name: 'about',
                url: '/about',
                template: '<h3>Its the UI-Router hello world app!</h3>'
                name: 'hello',
                url: '/hello',
                template: '<h3>Hello world. How are you!</h3>'


Hello World Screenshot

Following is how the above code would look like in a web page.


Ajitesh Kumar

Ajitesh Kumar

Ajitesh is passionate about various different technologies including programming languages such as Java/JEE, Javascript, PHP, C/C++, mobile programming languages etc, and, computing fundamentals related with cloud-native technologies, application security, cloud computing platforms, mobile apps, big data etc.

He has also authored the book, Building Web Apps with Spring 5 and Angular.
Ajitesh Kumar

Leave A Reply

Time limit is exhausted. Please reload the CAPTCHA.