【发布时间】:2015-09-09 16:36:04
【问题描述】:
我正在使用 ionic 构建应用程序。
现在我想使用状态通过 url 传递一个变量,但它不起作用。最好的方法是什么?
我的做法:
$stateProvider
.state('orders', {
url: "/orders",
abstract: true,
templateUrl: "views/side-menu.html",
cache: false,
controller: 'OrderCtrl'
})
.state('orders.view-order', {
url: "/view-order?orderid", //<---- THIS ONE
views: {
'menuContent': {
templateUrl: "views/view-order.html"
}
},
cache: false
})
.state('orders.open-orders', {
url: "/open-orders",
views: {
'menuContent': {
templateUrl: "views/open-orders.html"
}
},
cache: false
})
我有一个基本控制器“仪表板”,我想通过它发送订单使用
$state.go("orders.view-order", {'orderid': '232323232'});
然后是订单控制器...(只显示一个空对象:(
angular.module(appName).controller('OrderCtrl',
function($location, $rootScope, $scope, $ionicPopup,
$state, $stateParams, $auth, $ionicLoading,
$timeout, $interval, newOrderService, jwtHelper){
console.log($stateParams)
});
【问题讨论】:
标签: javascript angularjs state angular-ui-router