Im stuck in a problem that i have to open a specific page in ionic framework using the controller. I have to go to the following page
#/tab/hotel_details/1
when i click ok button in the ionic popup window
$scope.showAlert = function() {
var alertPopup = $ionicPopup.alert({
title: 'Click OK for further details',
});
alertPopup.then(function(res) {
//Go to a specific page
});
};
I cant use $state.go("tab.hotel_details");
, because i have to go to hotel_details/1
I have to get rid of the above problem for further development of my app.
You can still use the $location service if you want to navigate to a particular url instead of navigating by a state.
$location.path('/tab/hotel_details/1');
You can pass the id in the second parameter of the call to $state.go
:
$state.go("tab.hotel_details", { "id": id })
Then, in your controller, you can retrieve the value from $stateParams
:
var id = Number($stateParams.id)
Reference: Angular-ui State