即使无法获得ng-repeat的范围也有问题

时间:2019-02-17 14:53:38

标签: javascript html angularjs angularjs-ng-repeat angularjs-ng-show

这是代码

 <tr ng-repeat="x in arry" ng-init="initscope($parent)" ng-mouseover="hoverIn()" ng-mouseleave="hoverOut()">
          <td>{{x.name}}</td>
          <td>{{x.review}}</td>
          <td>{{x.rating}}</td>
          <td>
            <button ng-click="edit($index)"  ng-init="shw=false" ng-show="shw" class="btn waves-effect waves-white btn-small" style="background-color:#b23c3c;">Edit
              <i class="material-icons right">edit</i>
            </button></td>
          <td>
              <button ng-click="delete($index)" ng-init="shw=false" ng-show="shw" class="btn waves-effect waves-white btn-small" style="background-color:#b23c3c;">Delete
                  <i class="material-icons right">cancel</i>
                </button>
          </td>
        </tr>

我正在做的是,当我将鼠标悬停在行上时,我希望显示这两个按钮。 这是js代码

   $scope.initscope=function($prntscope)
 {
     $scope.ngrptscope=$prntscope;
 }
 $scope.hoverIn=function(){
        $scope.ngrptscope.shw=true;
        console.log("in hover in"+$scope.shw);
 }

 $scope.hoverOut=function(){
$scope.ngrptscope.shw=false;
        console.log("in hover out"+$scope.shw);   
  }

0 个答案:

没有答案