2016-12-27 63 views
0

移动与paramentrs另一页由国家PARAMS正确工作

$scope.singlepage = function($url) { 
      $url; 
      console.log($url); 
      $state.go('app.paymentinfo', { "userId": $url}); 
      }; 

有加状态和状态PARAM

angular.module('app.feedback').controller('singleCourseFeedbackCtrl', ['feedbackApiSet','$scope','$state','$stateParams','httpService','fileReader', 
    function(feedbackApiSet,$scope, $stateParams, $state,httpService,fileReader){ 

,但在我的代码$ stateParams,$状态混合起来

当我得到这样的代码:

我的代码无法正常工作。获得控制台错误不确定状态PARAM无法读取属性“”

angular.module('app.feedback').controller('singleCourseFeedbackCtrl', ['feedbackApiSet','$scope','$stateParams','$state','httpService','fileReader', 
    function(feedbackApiSet,$scope, $stateParams, $state,httpService,fileReader){ 

我如何获得PARAMS $scope.showprofile = $stateParams.params.userId;

我的状态模块:

.state ('app.singleCourseFeedback', { 
          url : '/singleCourseFeedback/:userId', 
      templateUrl : 'modules/feedback/views/singleCourseFeedback.html', 
      controller : 'singleCourseFeedbackCtrl' 
         }) 

为什么所有的工作,如果他们写不正确?

+0

'$ state.params.userId'或'$ stateParams.userId',但不是'$ stateParams.params.userId' – TheSharpieOne

回答

3

只使用$stateParams.userId;没有params。