Angular + VB.NET - Routing not working

So I'm working on a project which uses AngularJS and a Web API written in VB.NET All of this works fine untill we have to maintain the routing.

The following code is from my angularApp, which defines the routing.

var angularApp = angular.module('AngularApp', ['ngRoute']);
    function ($routeProvider) {
            .when('/ExpenseOverview', {
                controller: 'ExpenseOverviewController',
                templateUrl: 'Angular/Views/ExpenseOverview.aspx'
                controller: 'AddExpenseController',
                templateUrl: 'Angular/Views/AddExpense.aspx'
                controller: 'AddExpenseController',
                templateUrl: 'Angular/Views/ApproveExpense.aspx'
            .when('/Organogram', {
                controller: 'AddExpenseController',
                templateUrl: 'Angular/Views/Organogram.aspx'
            .when('/AddType', {
                controller: 'AddExpenseController',
                templateUrl: 'Angular/Views/AddType.aspx'
            .when('/ExpenseEvidence', {
                controller: 'AddExpenseController',
                templateUrl: 'Angular/Views/ConfirmExpenseEvidence.aspx'
        .otherwise({ redirectTo: '/ExpenseOverview' });

EDIT I used .aspx pages because I wanted to use some code behind. If necessairy, I'll change them to static HTML files.

Everything works fine on startup, the routing works as it was programmed to.
Startup routing

Next to that, when I navigate to other pages, the routing still works like expected.
Navigation works fine - URL changed with routing

But from that point on, when I navigate back to the main form with the back button from Chrome, it all falls apart.

When I click on this button to navigate to another page (label is in Dutch), the routing isn't even triggered. This button is a simple HTML5 button and I also tried with a simple tag. It just triggers a postback (sort of, the screen flashes for a second) and nothing happens.
Button navigating to another page

So in an attempt to reset everything, I tried to reload the page and this is what becomes of my URL:
URL after reloading the page

And after navigating to another page, it just changes the "#/???" part of my URL, which basically means that my routing is changed completely and I have no clue what is causing this.

Can anyone elaborate on this problem? Maybe an explanation about what I am doing wrong? If it's because of the .aspx pages, I'll need to find a solution on how to work with ResourceFiles on views that are written in HTML.



Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.