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);