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.

ui-sortable + ng-repeat selects text, requires extra click, with jQuery 2.0 #2

@pmanijak

Description

@pmanijak

The code below is a ui-sortable list that uses ng-repeat, using jQuery 2.0.

The first attempt to drag and drop an item in the list will result in selecting text in the list, instead of moving the element. The second attempt works as expected, as do all attempts after that. When the page is refreshed, we're in a broken state again.

With jQuery 1.x, everything is fine.
If the ng-repeat is removed from the situation, and a static list is used instead, everything is fine.

Hard to say if this is an issue with jQuery, Angular, or Angular-ui, but the narrowed-down code below is a step toward answering that question.

    <!doctype html>
    <html lang="en" ng-app="myApp">
    <body>

    <div ng-controller="MyCtrl1">
      <ul ui-sortable ng-model="test">
        <li ng-repeat="t in test">
          {{t.name}}
        </li>
      </ul>
    </div>

    <!-- jQueryUI is required by AngularUI -->
    <script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
    <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/jquery-ui.min.js"></script>

    <script src="lib/angular/angular.js"></script>
    <script src="lib/angular-ui/angular-ui.js"></script>

    <script>
        'use strict';
        angular.module('myApp', ['ui']);

        function MyCtrl1($scope) {
          $scope.test = [
            { name: "one" },
            { name: "two" }
          ];
        }
      </script>
    </body>
    </html>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions