Answer the question
In order to leave comments, you need to log in
Why does the application go into an infinite loop?
If you connect jQuery to Angular, when you go to another page, the application goes into an endless loop and jumps from the previous page to the selected one. I am using uirouter. If you include jQuery after Angular, everything is ok.
<script src="./lib/jquery-1.11.0.min.js" type="text/javascript"></script>
<script src="./lib/jquery-migrate-1.2.1.min.js" type="text/javascript"></script>
<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/angular-ui-router/release/angular-ui-router.js"></script>
$stateProvider
.state('public', {
abstract: true,
template: "<div ui-view></div>",
data: {
access: access.public
}
})
.state('public.404', {
url: '/404/',
templateUrl: './templates/404.html',
data: {
bodyClass: 'page-404-3'
}
})
.state('public.403', {
url: '/403/',
templateUrl: './templates/403.html',
data: {
bodyClass: 'page-404-3'
}
});
// Anonymous routes
$stateProvider
.state('anon', {
abstract: true,
template: "<div ui-view></div>",
data: {
access: access.anon
}
})
.state('anon.login', {
url: '/login/',
templateUrl: './templates/login.html',
data: {
bodyClass: 'login',
redirectTo: 'admin.dashboard'
}
});
$stateProvider
.state('admin', {
abstract: true,
templateUrl: "./templates/main.html",
data: {
access: access.admin,
bodyClass: 'page-header-fixed page-container-bg-solid page-sidebar-closed-hide-logo page-header-fixed-mobile page-footer-fixed1'
}
})
.state('admin.dashboard', {
url: "/dashboard/",
templateUrl: "./templates/dashboard.html"
});
// Images routes
$stateProvider
.state('admin.images-all', {
url: "/images/",
templateUrl: "./templates/images-all.html",
controller: 'AllImagesCtrl',
controllerAs: 'allImagesCtrl'
})
.state('admin.images-add', {
url: "/images/add/",
templateUrl: "./templates/images-add.html",
controller: 'AddImagePageCtrl',
controllerAs: 'addImagePageCtrl'
})
.state('admin.images-edit', {
url: "/images/:id/",
templateUrl: "./templates/images-edit.html",
controller: 'EditImageCtrl',
controllerAs: 'editImageCtrl'
});
// Categories routes
$stateProvider
.state('admin.categories-all', {
url: "/categories/",
templateUrl: "./templates/categories-all.html",
controller: 'AllCategoriesPageCtrl',
controllerAs: 'allCategoriesPageCtrl'
});
// Products routes
$stateProvider
.state('admin.products-all', {
url: "/products/",
templateUrl: "./templates/products-all.html",
controller: 'AllProductsPageCtrl',
controllerAs: 'allProductsPageCtrl'
})
.state('admin.products-edit', {
url: "/products/:id",
templateUrl: "./templates/products-edit.html",
controller: 'EditProductsPageCtrl',
controllerAs: 'editProductsPageCtrl'
});
<a ui-sref="admin.products-edit({ id: product.id })">
Изменить
</a>
Answer the question
In order to leave comments, you need to log in
This is a failure :(
One of the jQ plugins spoiled the blood - removed it and everything became fine. It is not clear why the infinite loop did not occur if jq was connected after angular, but oh well. It doesn’t matter anymore.
Did they remove the ability to transfer the question to / tmp? (
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question