ng-view not fetching my template Angular 1.6.2


  .when('/bookings', {
    templateUrl: '/mybookings.html',
    controller: 'accountCtrl'
  .when('/credits', {
    templateUrl: '/mycredits.html',
    controller: 'myCreditsCtrl'
  .when('/membership', {
    templateUrl: 'membership.html',
    controller: 'membershipCtrl'
  .when('/profile', {
    templateUrl: 'profile.html',
    controller: 'profileCtrl'
  .when('/invoices', {
    templateUrl: 'invoice.html',
    controller: 'invoiceCtrl'
  .when('/team', {
    templateUrl: 'team.html',
    controller: 'teamCtrl'
  .when('/benefits', {
    templateUrl: 'benefits.html',
    controller: 'benefitsCtrl'
  .when('/refer', {
    templateUrl: 'refer.html',
    controller: 'referCtrl'
  .when('/support', {
    templateUrl: 'support.html',
    controller: 'supportCtrl'
  .when('/about', {
    templateUrl: 'accountabout.html',
    controller: 'accountAboutCtrl'

and this my html in which I am injecting views

<!DOCTYPE html>
<html ng-app="TFC">

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>The Founder's Cafe</title>
    <link href=",900" rel="stylesheet">
    <link rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap.min.css">
    <link rel="stylesheet" href="assets/css/style.css">

    <section style="background: black;">
        <div class="navbar navbar-default" style="position: static;">
            <div class="navigation-wrapper">
                <a href="/" class="custom-logo"><img src="assets/img/webLogo.png" alt="TFC Logo"></a>
                <ul class="custom-navbar nav navbar-nav">
                    <li class="about-link active"><a href="/about.html" class="nav-links">About Us</a></li>
                    <li><a href="/facility.html" class="nav-links">Facilities</a></li>
                    <li><a href="/pricing.html" class="nav-links">Pricing</a></li>
                    <li><a href="/event.html" class="nav-links">Events</a></li>
                    <li><a href="/gallery.html" class="nav-links">Gallery</a></li>
                    <li><button type="button" class="btn btn-default btn-lg navbar-btn" name="button">LOGIN</button></li>
                <div class="ham-wrapper">
                    <div class="hambar-1"></div>
                    <div class="hambar-2"></div>
                    <div class="hambar-3"></div>
        <div style="position: relative; height: 35em; overflow: hidden; background: url(''); background-attachment: fixed;">
            <div class="overlay">&nbsp;</div>
        <div class="account-wrapper">
            <div class="account-items">
                <div class="header">
                    <div class="user-image"><img src="" alt=""></div>
                    <div class="user-header">
                <div class="user-items">
                    <div class="item">
                        <div class="item-main">
                            <img src="assets/img/account/icn-booking.png" alt="">
                            <h5 class="item-name"><a href="#/bookings">My Booking</a></h5>
                        <div class="item-arrow"><img src="" alt=""></div>
                    <div class="item">
                    <div class="item-main">
                        <img src="assets/img/account/icn-logout.png" alt="">
                        <h5 class="item-name"><a href="">Logout</a></h5>
         <div class="account-display">
             <div ng-view=""></div>
    <script src=""></script>
    <script src="node_modules/jquery/dist/jquery.min.js" charset="utf-8"></script>
    <script src="node_modules/angular/angular.min.js" charset="utf-8"></script>
    <script src="node_modules/ng-dialog/js/ngDialog.min.js" charset="utf-8"></script>
    <script src="node_modules/angular-route/angular-route.min.js"></script>
    <script src="node_modules/bootstrap/dist/js/bootstrap.min.js" charset="utf-8"></script>
    <script src="node_modules/jwt-decode/build/jwt-decode.min.js" charset="utf-8"></script>
    <script src="assets/js/style.js" charset="utf-8"></script>
    <script src="assets/js/app.js" charset="utf-8"></script>


the mybookings.html is in the root folder.

<div class="bookings-header">
  <img src="assets/img/account/icn-booking.png" alt=""><h4>My Bookings</h4>
<div class="bookings-info-wrapper"></div>
  <div class="bookings-info">

    <div class="coworking-info">
        <p>Dedicated Desk(Dec 1-Dec 30)</p>

the ng-view directive is inside div.account-display and as a test I am trying to show just the mybookings.html when user clicks on the my bookings list item which is inside the first div.item inside div.user-items

The ng-view isn’t showing anything, nor am I getting any error. An interesting thing is that when I looked into the network tab of my dev console, mybookings.html is not mentioned in it.

My angular js and angular-route versions are 1.6.2. The jquery version is 3.1.1

Need help with this


i created demo and it seems to working fine. If you sure the html file paths are exist then other possible downfall might be version conflict.Check the angular route and angular version is compatible with each other.

  <script data-require="angular.js@1.6.1" data-semver="1.4.9" src=""></script>
  <script data-require="angular-route@1.4.3" data-semver="1.4.3" src=""></script>


Routes in Angular 1.6 need to add ! when redirecting to state.

<h5 class="item-name"><a href="#!/bookings">My Booking</a></h5>

Answered By – Sachila Ranawaka

Answer Checked By – Jay B. (AngularFixing Admin)

Leave a Reply

Your email address will not be published.