Here is the structure of my app.js:
var app = angular.module('landingPage', [
'ngRoute',
'application.controllers',
...
])
app.config(['$routeProvider', '$locationProvider',
function($routeProvider, $locationProvider) {
$routeProvider
.when('/', {
templateUrl: 'partials/home',
controller: 'mainController'
})
.when('/sing_in', {
templateUrl: 'partials/sing_in',
controller: 'signInController'
})
.otherwise({
redirectTo: '/'
})
$locationProvider.html5Mode(true)
}
])
In my view
s directory, I have set up multiple pages as I am transitioning from server side routing to Angular:
The routes on the server side are defined as follows: module.exports = function(app) {
var api = App.route('Api')
var routes = App.route('Routes')
app.get('/partials/:name', routes.partials)
app.get('/image/:id', routes.image)
app.get(new RegExp('^(?!api).*$'), routes.index)
app.get('/api/...', api.handleThis)
I am facing an issue where I keep getting redirected to /
due to the otherwise
clause in the Angular router. The calls to /partials/sign_in
are not being made. I even tried adding a /
before the tempalteUrl
, but it did not resolve the problem.