无法读取属性' splice'未定义的离子范围

时间:2017-04-13 19:48:06

标签: javascript angularjs ionic-framework mean-stack

我希望每个滑块都有一个删除选项。但它没有工作,给我一个typeError,拼接是未定义的。我知道我遗漏了一些东西:(它没有抓住我的滑块数据来删除

 <div id="diarylogs" ng-controller="diarylogsCntrl">
   <ion-content>

   <h2>Diary Log</h2>

   <button class="button button-icon icon ion-ios-compose-outline"
    ng-click="showDelete = !showDelete" id="editButton"></button>

  <ion-list show-delete="showDelete">


  <ion-item>

   <div class="sliderList"> 
   <ion-delete-button class="ion-ios-trash-outline" ng-click="deleteSlider()" id="trash"></ion-delete-button>

   <span>{{diarylogs[0].slider}}</span>
   <div id="Slider">{{pickednumber}} hours</div>
   <div class="range range-positive">0
   <input type="range" name="volume" min="0" max="5" ng-value="
    {{pickednumber}}" ng-
      model="pickednumber">5 
   </div> 
   </div>
    </ion-item>
  </ion-list>

  </ion-content>
  </div>

控制器

 HCapp.controller('diarylogsCntrl', ['$scope','$http',function($scope, $http ){
  $http.get('http://localhost:3000/diarylogs').then(function(diarylogs){

 $scope.diarylogs = diarylogs.data


 //getting each slider name
 $scope.slider1 = diarylogs.data[0].slider;

 $scope.pickednumber= '0';

 $scope.deleteSlider= function(slider1){
 $scope.slider1.splice($scope.slider1.indexOf(slider1), 1);

 };
 })}]);

0 个答案:

没有答案