The remaining and incomprehensible problem is here:
angular.module('Productportfolio', ['ngRoute', 'ProductService', 'ProductCtrl']) .config(['$routeProvider, $locationProvider',
config() function of the module object takes as an argument an array of strings, and not a string with "," as the char delimiter inside it. See an example and a document here: https://docs.angularjs.org/guide/providers#provider-recipe
So this should be:
angular.module('Productportfolio', ['ngRoute', 'ProductService', 'ProductCtrl']) .config(['$routeProvider', '$locationProvider',
Update :
But in fact, in your case, it works even without a precision array:
angular.module('Productportfolio', ['ngRoute', 'ProductService', 'ProductCtrl']) .config(
I updated plunker and app.js from both versions. I got the impression that the array is optional (more). Therefore, it is better to ignore this parameter, especially if it has poor value, it can create side effects.
Here's the plunker with corrections (ordered function lib, typos and config): http://plnkr.co/edit/NTn6Zmav5RX4V8zgHPOG?p=preview
I deleted $locationProvider.hashPrefix('!') As not suitable for the URL you are using. See @ AndreaM16's answer for this.
In addition, you have not yet announced your service that you want to use in your controller.
app.js
angular.module('Productportfolio', ['ngRoute']) .config(['$routeProvider', '$locationProvider', function ($routeProvider, $locationProvider) { $routeProvider .when('/home', { templateUrl: 'home.html', controller: 'ProductCtrl' }) .when('/private', { templateUrl: 'private.html', controller: 'ProductCtrl' }) .otherwise({ redirectTo: '/home', controller: 'ProductCtrl' }); }] );
or app.js without an array parameter in the config function:
angular.module('Productportfolio', ['ngRoute']) .config( function ($routeProvider, $locationProvider) { $routeProvider .when('/home', { templateUrl: 'home.html', controller: 'ProductCtrl' }) .when('/private', { templateUrl: 'private.html', controller: 'ProductCtrl' }) .otherwise({ redirectTo: '/home', controller: 'ProductCtrl' }); // $locationProvider.hashPrefix('!'); } );
index.html:
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>AngularJS Plunker</title> <script data-require=" jquery@ *" data-semver="3.0.0" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0/jquery.js"></script> <script src="https://www.atlasestateagents.co.uk/javascript/tether.min.js"></script> <link data-require=" bootstrap@ *" data-semver="4.0.0-alpha.2" rel="stylesheet" href="https://cdn.rawgit.com/twbs/bootstrap/v4-dev/dist/css/bootstrap.css" /> <script data-require=" bootstrap@ *" data-semver="4.0.0-alpha.2" src="https://cdn.rawgit.com/twbs/bootstrap/v4-dev/dist/js/bootstrap.js"></script> <script data-require=" angularjs@1.5.8 " data-semver="1.5.8" src="https://opensource.keycdn.com/angularjs/1.5.8/angular.min.js"></script> <script data-require=" angular-route@ *" data-semver="1.5.8" src="https://code.angularjs.org/1.5.8/angular-route.js"></script> <script src="app.js"></script> <script src="ProductCtrl.js"></script> </head> <body ng-app="Productportfolio"> <ul> <li> <a href="#home">Home</a> </li> <li> <a href="#private">Log in</a> </li> </ul> <div ng-view></div> </body> </html>