Trying to do the simplest routing, instead of it there is only a comment in the markup <!-- ngView: --> without a div, what am I doing wrong?

Markup:

 <html data-ng-app="myApp"> <head lang="ru"> <script src="vendor/angular.js"></script> </head> <body> <ul> <li class="page-nav_item"> <a href="/create" class="page-nav__item-link">Наши сервисы</a> </li> <li class="page-nav_item"> <a href="/about" class="page-nav__item-link">О компании</a> </li> </ul> <div ng-view></div> <!-- bower:js --> <script src="vendor/angular-animate.js"></script> <script src="vendor/angular-aria.js"></script> <script src="vendor/angular-material.js"></script> <script src="vendor/angular-messages.js"></script> <script src="vendor/angular-resource.js"></script> <script src="vendor/angular-route.js"></script> <!-- endinject --> <!-- Begin: Source JS --> <!-- inject:js --> <script src="app/app.module.js"></script> <script src="app/app.config.js"></script> <!-- endinject --> </body> </html> 

app.module.js:

 'use strict'; angular.module('myApp', [ 'ngMaterial', 'ngMessages', 'ngRoute', ]); 

config.js:

  'use strict'; angular .module('myApp') .config(['$routeProvider', function($routeProvider) { $routeProvider .when('/create', { template: '<h1>Create</h1>' }) .when('/about', { template: '<h1>About</h1>' }) } ]); 

    1 answer 1

    I decided that I used angular version 1.6.3 and here https://docs.angularjs.org/guide/migration#commit-aa077e8 says that hashPrefix is ​​changed. So 2 errors:

    1. config.js change to:

     'use strict'; angular .module('mindMapApp') .config(['$locationProvider','$routeProvider', function($locationProvider, $routeProvider) { $locationProvider.hashPrefix(''); $routeProvider .when('/create', { template: '<h1>Create</h1>' }) .when('/about', { template: '<h1>About</h1>' }) } ]); 

    Adding $ locationProvider and the default value as a prefix.

    1. In the links you need to specify the address with a hash (by default with a #!)

      <a href="#/create" class="page-nav__item-link">Наши сервисы</a> instead of <a href="/create" class="page-nav__item-link">Наши сервисы</a>