Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular - no method sortable

I am including all necessary scripts (The error was in order of the scripts + missing jQuery):

<script src="scripts/vendor/angular/angular.js"></script>
<script src="components/angular-bootstrap/ui-bootstrap-tpls.js"></script>
<script src="components/angular-ui/build/angular-ui.js"></script>

And using this code snippet:

<div ng:controller="controller">
    <ul ui:sortable ng:model="list">
        <li ng:repeat="item in list" class="item">{{item}}</li>
    </ul>
    <hr />
    <div ng:repeat="item in list">{{item}}</div>
</div>

But I keep getting this error:

TypeError: Object [object Object] has no method 'sortable'

Anybody ever experienced the same and knows the way out?

like image 521
Michal Avatar asked Dec 21 '22 07:12

Michal


1 Answers

You are missing jquery-ui library. angular-ui make use of jquery-ui library to provide sortable functionality.

angular-ui library depends on jquery-ui library, so download and add the jquery-ui.css and jquery-ui.js to the project.

Also jquery-ui needs jquery library, so if you have not included it, download an include it also.

like image 125
Arun P Johny Avatar answered Dec 22 '22 21:12

Arun P Johny