0

i am coding an angular app i already created my app routing

AdminDashboard.config(['$routeProvider','$locationProvider',function($routeProvider, $locationProvider){    
    $routeProvider
        .when('/',{
            templateUrl: '../dashboard/administration/dashboard.html',
            controller : 'Dashboard'}
            )
            //Students Routes
        .when('/Students', {
            templateUrl : '../dashboard/administration/students/students.html',
            controller: 'ShowStudentsController'}
             )
        .when('/Students/:studentId/edit',{
            templateUrl : '../dashboard/administration/students/modals/edit.html',
            controller: 'EditStudentsController'
        })
        .when('/Students/create',{
            templateUrl : '../dashboard/administration/students/modals/create.html',
            controller: 'CreateStudentsController'
        });
        }]);

and the history wasn't working i did a research on Anuglar API and i found that i've to add.

$locationProvider.html5Mode(true); 

and then the browser back button was working and getting to the previous route but the template won't render. Please help me. And i hope my question is clear.

12
  • Here is a post on Angular Back button stackoverflow.com/questions/14070285/… Commented Mar 1, 2015 at 13:21
  • The console is always saying the angular.map files are missing? Commented Mar 1, 2015 at 13:26
  • Thanks Paul, thats one solution. but how can i handle the browser back button Commented Mar 1, 2015 at 13:30
  • what's happening with the browser back button now? ANy errors? Commented Mar 1, 2015 at 13:38
  • Without adding the locationProvider it's not returning to the previous page but the template of the actual page is working normally, but when adding the locationProvider the history mapping is working but no template rendering and the only errors that are showing are the missing map files and that was the case even before adding the locationProvider. Commented Mar 1, 2015 at 13:47

1 Answer 1

0

(sorry, my rep is too low to add this as a comment but...)

I had a similar weird problem with routing not working earlier and it turned out to be a stray # link from the basic page design. I'm sure there's a perfectly good reason for that, but clicking on this # link would break all browser navigation for the remainder of the session.

Replacing those # hrefs with #/ prevented the problem for me.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks, for bringing me joy ^^ really appreciate it. it worked just fine now
You're welcome, I ended up implementing all sorts of providers and services and whatnot until I finally realized what was actually causing the problem. Glad to have saved you something of that aggravation :)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.