Angularjs ui-sortable: cannot call methods when sorting before initialization; tried to call the 'refresh' method

I am trying to make a sort list, I am taking an element from db, but ...

Error: it is impossible to call sorting methods before initialization; tried to call the 'refresh' method

My html:

<div class="box-body" > <div ng:controller="menuConfigCtrl"> <ul ui-sortable ng-model="menu" > <li ng:repeat="item in menu |filter:'all' | orderBy:'order':false" >{{item.Title}}</li> </ul> </div> </div> 

And my controller:

 function menuConfigCtrl($location,$scope, menuFactory) { $scope.menu = []; menuFactory.getMenu().success(function(data){ $scope.menu = data; }); } 

My getMenu() :

 getMenu : function(){ return $http({ url: '/api/menuList', method: 'GET', }); }, 

If I get the menu not from the recreation service, but by tying it, everything works without errors! What could be?


Problem solved: I imported angularjs.js twice.

+6
source share
1 answer

The problem is resolved: I imported angularjs.js twice.

-1
source

Source: https://habr.com/ru/post/948259/


All Articles