I have a router partially, a node (express) is partially angular. On certain pages an Angular application is made (with ui-router). When I cut it to a village where there is an angular application, I can’t get out of it later (for example, go to the homepage of the store (on the angular store page of the angular application with ui-router)), the links don't work.
Code on the server:

router.get('/range', function (req, res, next) { res.render('range', {ru : "ru"}); }); router.get('/range/*', function (req, res, next) { res.render('range', {ru : "ru"}); }); 

Angular code

 (function (angular) { "use strict"; angular.module('application', ['ui.router', 'ngAnimate']) .config(['$locationProvider', '$stateProvider', '$urlRouterProvider', function ($locationProvider, $stateProvider, $urlRouterProvider) { $locationProvider .hashPrefix('!') .html5Mode(true); $stateProvider .state('product', { url: '/range', templateUrl: 'app1/views/product.html', controller: 'productCntr' }) .state('products', { url: '/range/:id?', templateUrl: 'app1/views/product.html', controller: 'productCntr' }) }]); })(angular); 

Controller

 (function (angular) { "use strict"; angular .module('application') .controller('productCntr', ['$scope', '$rootScope', '$state', '$location', function ($scope, $rootScope, $state, $location) { var id = $state.params.id || -1; $scope.model = { productId: id }; } ]); })(angular); 

Closed due to the fact that off-topic participants Grundy , aleksandr barakin , cheops , Bald , user194374 6 Jul '16 at 6:42 .

It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reason:

  • “Questions asking for help with debugging (“ why does this code not work? ”) Should include the desired behavior, a specific problem or error, and a minimum code for playing it right in the question . Questions without an explicit description of the problem are useless for other visitors. See How to create minimal, self-sufficient and reproducible example . " - Grundy, aleksandr barakin, cheops, Bald, Community Spirit
If the question can be reformulated according to the rules set out in the certificate , edit it .

  • it’s worth checking the links that attempt to go, but the coincidence of the routes is already alarming - Grundy
  • <li> <a href="/range"> Assortment </a> </ li> Links are normal, they work if you go to them from those pages where there is no Angular application - arseniy mironov
  • in an angular path with the same url - Grundy
  • what you say garbage - arseniy mironov
  • what exactly from ?. - Grundy

2 answers 2

Subscribe to the error of the transition in the angulyar and bypassing the wrappers set window.location.href .

    This can be done by setting default links # / then the backend will not conflict with Angular and vice versa