Angular routing, multiple server requests

I want to use angularjs routing, I use, but it makes additional requests on the server side. Does anyone know a solution to this problem, or am I doing something wrong?

Client app.js

app.config(['$routeProvider', '$locationProvider', function($routeProvider, $locationProvider) {
    $locationProvider.html5Mode({enabled: true, requireBase: false})
    $routeProvider.
        when('/', {
            templateUrl: '/tpl/main.tmp.html',
            controller: 'MainCtrl'
        })
        .otherwise({redirectTo: '/'})
}])

//routes.js
app.get('/', function(req, res) {
    console.log("test")
    res.render(__dirname+'/public/tpl/index.html', siteConfig)
})
//output
//test
//test
//test
//test

Files:

models
public
|-css
|-js
|--app.js
|--angular.js
app.js
0
source share
1 answer

This can lead to several things, a closer inspection of both request packets can narrow the cause. Some ideas to check:

0

All Articles