I'm trying to get Angular to ignore links if the route doesn't exist, and let http do the work.
I have a large Laravel app, and I'm trying to implement AngularJS for some front end stuff.
The problem I have, is I want to slowly add Angular code to each page but have the rest of the app to function as usual. It's not a single page app as such, but a multipage app with angluar functionality.
This is my Angular Routing:
app.config(['$routeProvider', '$locationProvider', function($routeProvider, $locationProvider) {
$routeProvider.
when('/clients/:ClientID', {
templateUrl: "resources/js/angular/partials/DisplayLogCtrl.html",
controller: 'DisplayLogCtrl'
}).
otherwise({
//Go to normal Laravel route
});;
$locationProvider.html5Mode(true);
}]);
Normal links, like <a href="/" class="reminder_reminder">Dashboard</a>
don't function correctly. The URL in the address bar is changed, but nothing changes onscreen.
Does anyone know why this happens? ..and whether I'm going to be able to do what I want to do?
Angular uses hash routing, so ng-route only really looks at the path, not the whole url. A hash route looks like this: www.example.com/#/client/14
. If you're on that page and click a link to '/', your browser will think it's already on that page and do nothing. I'm guessing angular doesn't see the path change, which is why nothing is happening, but it's hard to know without seeing more of your code.