I have the below Angular function.
Function :
var App = angular.module('app', ['ui.bootstrap', 'ngRoute', 'ngAnimate']); App.config(['$routeProvider', function($routeProvider) { $routeProvider .when('/', { templateUrl: 'views/dashboard.html' }) .when('/:pages', { templateUrl: function(routeParams) { return 'views/' + routeParams.pages + '.html'; } }) .otherwise({redirectTo: '404.html'}) }]);
I have a sidebar navigation control. And I've created 4 pages.
So when I click on those navigation items the respective pages open up correctly.
And there are some more pages that I haven't created yet. But as per the below function.
When I don't have something that doesn't exists, it must return to 404.html
file that exists in the root of the folder.
What's happening is, I don't get a error in the console and the url the in the address bar reflects the last clicked valid page.
Someone let me know where I'm doing the mistake and whether this method of is correct for dynamic routing?