AngularJs ngRoutes not working

Issue

I add this link tag <a href="#/pendingJobs"> And in Js wrote this type of when function

.when("/pendingJobs", {
    templateUrl : 'jobsPending.php',
    controller : 'appCtrl'
})

But when i click on link it create a url like that /#%2FpendingJobsdue to this linking problem .when("/pendingJobs" is not working..

Solution

Default value of the prefix is changed to to ‘!’.

I don’t know which angular version you are using.

But it should work with this changes.Change hashPrefix to ''

.config(function($locationProvider) {
  $locationProvider.html5Mode(false).hashPrefix('');
})

More here https://github.com/angular/angular.js/commit/aa077e81129c740041438688dff2e8d20c3d7b52

Answered By – RIYAJ KHAN

Answer Checked By – Katrina (AngularFixing Volunteer)

Leave a Reply

Your email address will not be published.