Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ng-sortable does not wait ($watch) for $scope.ngSortable #8

Open
brennancheung opened this issue Jul 28, 2015 · 1 comment
Open

ng-sortable does not wait ($watch) for $scope.ngSortable #8

brennancheung opened this issue Jul 28, 2015 · 1 comment

Comments

@brennancheung
Copy link

When items is undefined at the time the template is loaded the directive does not work.

This is very common when the items are populated from a REST API call.

Ex:

In controller:
setTimeout(function(){ $scope.items = [1,2,3]; }, 5000);

In HTML:
<div ng-sortable="items">...</div>

ng-sortable should implement a $watch for the $scope.ngSortable and only run the current linking code when it is defined and an array.

@schartier
Copy link
Owner

Please make a pull request. It would be appreciated, by me and others :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants