I am having a problem configuring angular routing. I have an application that loads manually (I need this function because I already have html5 navigation throughout the site and want angular to work only on a specific page - it works fine). But when I run my code, I have some problems:
- If
.otherwise provided, I got an infinite loop calling my controller and dying with Range error in Chrome - and I always got the URL redirect from the hash version to non-hash, even if I call
$locationProvider.html5Mode(false);
Guess that the problems can be caused by the fact that I already use history.js and event handlers for statechange events, but for now I am not looping. I need your help to get an answer.
Thank you for your time.
And the code.
HTML
<script> if (typeof angular === 'undefined') { Modernizr.load({ load: [ '/static/css/angular.css', '/static/js/libs/angular/angular.min.js', '/static/js/files/angular/app.js', '/static/js/files/angular/controllers.js', '/static/js/files/angular/filters.js', '/static/js/files/angular/services.js', '/static/js/libs/angular/angular-resource.min.js', ], complete: function () { angular.bootstrap(document.getElementById('manager'), ['manager']); } }); } else { angular.element(document).ready(function() { angular.bootstrap(document.getElementById('manager'), ['manager']); }); } </script>
app.js
var FM = angular.module('manager', ['managerFilters']) .config(['$routeProvider', '$locationProvider', function($routeProvider, $locationProvider) { $routeProvider .when('/home', { controller: FilesListCtrl, templateUrl: '/static/partials/1.html' }) .otherwise({ redirectTo: '/home' }); }]);
controllers.js
function FilesListCtrl($scope, $filter, $routeParams) { app.log('FilesListCtrl') }
source share