Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs 离子滑盒双向绑定不工作_Angularjs_Ionic Framework_Ion Slide Box - Fatal编程技术网

Angularjs 离子滑盒双向绑定不工作

Angularjs 离子滑盒双向绑定不工作,angularjs,ionic-framework,ion-slide-box,Angularjs,Ionic Framework,Ion Slide Box,我对离子滑盒的实现有问题 我想实现双向绑定,如下所示 谢谢你的帮助 谢谢,我找到了解决办法。也许有更好的方法来解决这个问题,但我现在只能想到这一点 我必须稍微修改一下离子滑盒指令 这是我的密码: Ionic bundle.js(在此处创建双向绑定) 指令.js directive('updateCounter', function(){ return{ restrict : 'A', scope : false, require : '^ionSlideBox',

我对离子滑盒的实现有问题

我想实现双向绑定,如下所示

谢谢你的帮助


谢谢,我找到了解决办法。也许有更好的方法来解决这个问题,但我现在只能想到这一点

我必须稍微修改一下离子滑盒指令

这是我的密码:

Ionic bundle.js(在此处创建双向绑定)

指令.js

directive('updateCounter', function(){
return{
    restrict : 'A',
    scope : false,
    require : '^ionSlideBox',
    link : function(scope,element, attrs,ctrl){
        $(element).click(function(){
            scope.counter = ctrl.getCounter();
            scope.counter--;
            ctrl.setCounter(scope.counter);
        })
    }
}})           
$scope.$on(
  "IncrementValue",
  function handleIncrementValue() {
        $scope.counter++;
  }
);
$scope.triggerEvent = function() {
  $scope.$broadcast( "IncrementValue" );
};
ViewController.js

directive('updateCounter', function(){
return{
    restrict : 'A',
    scope : false,
    require : '^ionSlideBox',
    link : function(scope,element, attrs,ctrl){
        $(element).click(function(){
            scope.counter = ctrl.getCounter();
            scope.counter--;
            ctrl.setCounter(scope.counter);
        })
    }
}})           
$scope.$on(
  "IncrementValue",
  function handleIncrementValue() {
        $scope.counter++;
  }
);
$scope.triggerEvent = function() {
  $scope.$broadcast( "IncrementValue" );
};
View.html

 <ion-slide-box counter="counter">
     <ion-slide>
       <button ng-click="trigger()">Increment box</button>
       <button update-counter>Decrement box</button>
     </ion-slide>
 </ion-slide-box>

增量框
减量箱
如果有更好的办法,请告诉我


谢谢

仍在等待解决方案