Skip to content
This repository was archived by the owner on Sep 8, 2020. It is now read-only.
This repository was archived by the owner on Sep 8, 2020. It is now read-only.

Infinite digest loop when using appendTo option with non-string value #330

@micah-williamson

Description

@micah-williamson

Example JSBin:

http://jsbin.com/loqepiyasa/2/edit?html,js,console,output

Steps to reproduce:

  • Create a table.
  • Make the table head cells sortable with ui-sortable.
  • Point the ng-model to an array of cell name to sort.
  • In the sortable options passed to ui-sortable add { appendTo: [any non-string. i.e. document.body] }

The problem actually goes away if you remove ng-model but obviously we'd like to use ng-model.

<div id="container" ng-controller="TestSortCtrl">
      <table>
        <thead>
          <tr ui-sortable="sortOptions" ng-model="numbers">
            <th ng-repeat="number in numbers">{{number}}</th>
          </tr>
        </thead>
      </table>
    </div>
.controller('TestSortCtrl', function($scope) {
  $scope.numbers = [1, 2, 3];
  $scope.sortOptions = {
    axis: 'x',
    items: 'th',
    helper: function(evt) {
      var target = angular.element(evt.target);
      var clone = target.clone();
      clone.css('top', target.position().top);
      return clone;
    },
    distance: 15,
    appendTo: document.body // remove this line and the issue goes away
  };
});

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions