代码之家  ›  专栏  ›  技术社区  ›  IWI

指令控制器与ng repeat的通信问题

  •  0
  • IWI  · 技术社区  · 6 年前

    ng-repeat ng重复

    指令模板

    <div class="taskList" ng-repeat="task in taskList | orderBy : dueDate">
      <div class="taskTopLine"></div>
      <div ng-class="taskCircleClass" ng-style="changeCircle" 
           ng-click="completeTask(task); fillCircle(task)">
      </div>
      <div class="task-check" ng-show="showCheck"></div>
      <p class="taskSubject" ng-click="goToTask(task); editTask(task)">
        {{ task.name }}
      </p>
    </div>
    

    const taskItem = ($state, DataService, $rootScope, $uibModal, $window, $ngConfirm, inform) => {
      return {
        restrict: 'EA',
        templateUrl: './app/views/directives/taskItem.directive.html',
        scope: {
          taskList: "="
        },
        link(scope, element, attrs) {
    

    控制器

    $scope.taskList = [];    
    DataService.getTasks().then(data => {
       const temp = _.filter(data, o => { return moment(o.dueDate).isAfter(begin) && moment(o.dueDate).isBefore(end); });
       $scope.client;
       $scope.taskList = temp;
       $scope.taskList.forEach((row, index) => {
            row.sequence = index;
       });
    });
    
    1 回复  |  直到 6 年前
        1
  •  0
  •   IWI    6 年前

    问题是 ng-hide ng-repeat