Michal
Michal

Reputation: 15669

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?

Upvotes: 4

Views: 1586

Answers (1)

Arun P Johny
Arun P Johny

Reputation: 388316

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.

Upvotes: 11

Related Questions