Answer the question
In order to leave comments, you need to log in
Why doesn't Angularjs ui-sref work until I reload the page or click another link?
There are links, by clicking on them a modal window opens. The first click works fine, but after closing the window, the link is not clickable until the page is reloaded or until I click on the adjacent link.
The link itself:
<a ui-sref="userState({userId: data.id })" data-ui-sref-opts="{reload:false}" data-toggle="modal">View</a>
.state("userState", {
parent: "app.new",
params: {
usertId: 0
},
onEnter: [
"$modal",
function($modal) {
$modal.open({
controller: "UserModalController",
templateUrl: 'users/modals/user-modal.html',
}).result.finally(function() {
$stateProvider.go('^');
});
}
]
});
Answer the question
In order to leave comments, you need to log in
Because ui-router operates with states. When you click on a link, you enter the app.new.userState state, which you enter with a modal window. But after you have closed the modal window, you remain in the same state, and re-clicking the transition to an already active state does not trigger.
Look into ui-router-extras if you need modals to bind to states.
PS or activate the previous / parent state on closing the modal
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question