首页 > 代码库 > ionic页面跳转传值 ng-click

ionic页面跳转传值 ng-click

  母页:加入$state

<button  class="button button-calm button-block" ng-click="toProducer(producerId)" style="padding: 0 50px; background-color:#12B7F5;" >
 &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
</button>
ng-click="toProducer(producerId)"

母页控制器:
 $scope.toProducer = function () {
         var tid = document.getElementById(‘taskid‘);
         var  TaskId = tid.textContent;
        $state.go(‘main.td‘, {producerId:TaskId});
        
    };

 APP.js

.state(‘main.td‘,{
    url:‘/td/:producerId‘,
    views:{
        ‘main-kssb‘:{
           templateUrl: ‘templates/kssb/td.html‘,
           controller: ‘TbCtrl‘
        }
    }
})

 

子页控制器:$state $stateParams

 var TaskId = $stateParams.producerId;

$stateParams.producerId:获取母页传入的值

 

 

 

 

 

 

 

 

 

ionic页面跳转传值 ng-click