转到离子框架中的特定页面

Son*_*tta 1 android angularjs cordova ionic-framework

我陷入了一个问题,我必须使用控制器打开离子框架中的特定页面.我必须转到下一页

#/tab/hotel_details/1
Run Code Online (Sandbox Code Playgroud)

当我在离子弹出窗口中单击确定按钮时

 $scope.showAlert = function() {
   var alertPopup = $ionicPopup.alert({
     title: 'Click OK for further details',
   });
   alertPopup.then(function(res) {
   //Go to a specific page
   });
 };
Run Code Online (Sandbox Code Playgroud)

我无法使用$state.go("tab.hotel_details");,因为我必须去hotel_details/1 我必须摆脱上述问题进一步开发我的应用程序.

Col*_*lin 7

您可以将调用的第二个参数中的id传递给$state.go:

$state.go("tab.hotel_details", { "id": id })
Run Code Online (Sandbox Code Playgroud)

然后,在您的控制器中,您可以从$stateParams以下位置检索值:

var id = Number($stateParams.id)
Run Code Online (Sandbox Code Playgroud)

参考:Angular-ui State