angular-chosen: element.chosen is not a function

My implementation:

The controller…

    angular.module('EXAMPLE').controller('exampleController', [$scope', 'localytics.directives' ] 
                         ....
                     $scope.colors=['blue', 'red','yellow'];

        .....

The view…

<select multiple chosen
                ng-disabled= "true"
                allow-single-deselect="true"
                data-placeholder="Selecciona la operacion..."
                ng-model="searchParams.colors"
                ng-options="oper for oper in colors"
                   style="width: 200px;"
   >
</select>

But i got this error image

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 21 (2 by maintainers)

Most upvoted comments

@leocaseiro haha thanks dude apologies for the error. could be i missed it cos i was linked to the discussion from https://github.com/mishguruorg/angular-timezone-selector

Switching the order fixed it for me. jQuery and chosen must be loaded before Angular.

Did you make sure chosen itself is included on your page? (not just the angular piece)

@leocaseiro Just figured out I haven’t loaded the chosen.jquery.min.js, My mistake

Hi @njcoutinho, Thanks for using angular-chosen.

It seems you need to include also the chosen library.

Please, read the documentation how to get started: http://leocaseiro.github.io/angular-chosen/#installation

PS: I appreciate if you open a separated issue for your case.

Hi @alilishan-omniphics, it’s on the docs, but seems nobody reads it, I might strip all content from the readme, so users will click at the docs link.

PS: That’s an Angular thing. You must use jquery before angular anytime.

Welp, I fixed it on my side. Just import jquery BEFORE angular.