AngularJS html5mode conflicting with third party library

39 views Asked by At

I have a situation with my Angular 1.8.x routing.

In my angularApp.js file, I have html5mode enabled like:

$locationProvider.html5Mode(true);

My NodeJS app does the following:

module.exports = function(express, app){
    var router = express.Router();
    
    router.get('/*', function(req, res){
        res.render('index.html');
    });

    app.use('/', router);
};

I do, however, have an issue with a third party library - Snipcart. What that is supposed to do is include E-commerce features to a frontend app. However, Snipcart's "checkout" button links to a URL with # in it and the Snipcart library doesn't work (doesn't go to the checkout and seems to do a few loops of the current page I am on).

My question is simply this - how can I workaround this? html5mode is a must unfortunately but I need to also be able to support links with a # in it.

Thanks in advance!

2

There are 2 answers

0
Sean On BEST ANSWER

I don't know if this can be classed as an answer but I spoke to Snipcart and couldn't get it to work. I guess Angular 1 is just indeed that old

1
George DW On

You can also consider urls without the hashtag in your project

http://joeljoseph.net/angularjs-remove-hash-from-url/