I am trying to redirect to another url using state.go
$state.go("description-page", {disease: 'Thyroid'});
I am not even getting the scroll on the page. But when I refresh it, it works. Can anyone please help?
Thanks.
It resolved by putting timeout,
$timeout({
$state.go("description-page", {disease: 'Thyroid'});
},1000)
Related
I have an angular.js application, where I am trying to redirect usgin the following code:
this.openPresentationDetails = function (presentationToShow) {
$location.path("/presentation");
};
It redirects to the proper page, however, the page appears greyed out. I have tried linking to other pages, and the result is the same.
Any ideas? Thanks.
I was invoking openPresentationDetails(...) from a modal form, I had to close the modal first and then redirect.
I'm a beginner with AngularJs and i have some trouble understanding how to use $cookieStore :/
I have a lot of buttons. Everytime a button is clicked, a distinct function is called in the controller, and in this function, i'm trying to store a value in a cookie
example :
$cookieStore.put('cookie', '1');
And at the loading of the page, i added this line :
alert($cookieStore.get('cookie'));
When we load the page for the first time, it's normal to get an "undefined" popup. But the problem is, even after clicking multiple buttons, i always got an undefined popup after refresh.
Here's a working demo : http://plnkr.co/edit/6kuqaT7ISpo7uEwLHcZn?p=preview
Please help
Thanks
I checked your plunker cookie is setting properly :-)
Use STOP AND RUN button for refresh :P
I saw similar problem with refresh + $cookieStore some time ago, try using sessionStorage, if your target browser(s) allow that.
What Angular version do you use?
I am refreshing a page in my controller with return $this->redirect($this->request->here);
Which works great.
But I want to add a GET variable to the refresh. Does anyone know how to do this?
It is not possible to use the Cakephp redirect function with controller and action because of the routing I am using. So this is not going to work for me
return $this->redirect($this->request->here . '?key=val');
I'm using angular-ui's router (v0.2.0) in a project and we're trying to reload a view. I've tried $state.transitionTo and also $state.go, but neither seem to do anything. Would anyone know how to do a reload?
Thank you!
The 3rd parameter of $state.go takes an options object which has a reload property, so doing something like
$state.go('resources', {start: $stateParams.start}, {reload:true});
Should do the trick - on the latest version I can confirm it works.
If you are using v 0.2.5
This is working . $state.reload()
Reference Link
In Angular UI route v0.2.5, there is a third parameter reload
$state.transitionTo(to, toParams [, options])
$state.go(to, toParams [, options])
Third parameter is optional.
$state.go('contacts', {sort: 'name' }, { reload: true });
If you are going from state A to state A again, the internals of the angular-ui would forbid it from reloading the state. You'd have to go to a different state to have a reload. That is to avoid clicking many times on the same link issuing a reload.
You can try switching to the same state, but with slightly different params, if you are that desperate to reissue a reload. But in my point of view, if you are in the same state, a reload shouldn't happen.
There is already also a similar question on SO:
$route.reload() does not work with ui-router
If you are ok with using grunt and building yourself there is a new $state.reload() feature. Or you can wait until v0.3 coming soonish.
Comment on similar question Reloading current state - refresh data by SimplGy:
Probably worth noting that none of these [edit: meaning $state.transitionTo('state'), $state.reload() or $state.go($state.current, {}, {reload: true})] actually reload the page as
well. If you want to reload the state AND the page, there is no
ui-router method for it I think. Do window.location.reload(true)
Another comment by edhedges improved this one by mentioning the use of
$window.location.reload()
Which works and I recommend using for the reloading a ui-view.
I lost two days trying to solve this problem by myself, but I give up. pleaseee help .
i want to load my tree using jstree and promise AngularJS
but I keep getting this error:
Uncaught Neither data nor ajax settings supplied.
i can see im my html page jsut the pluging loading and no result :(
y'll find in thi link my code .
http://plnkr.co/edit/kDjFCa4x6Ghyb3pwghXc?p=preview
Thank you very much :)
After some playing with your code, I got this: http://plnkr.co/edit/JfTVNdQnaGZV01wyQHtn
changes: third argument of scope.$watch to true, setting "json_data" to
"json_data" :{
"data":scope.jstree.data
}
(looks strange, but it's quirks of jsTree)