amitava82 / angular-multiselect

[NOT MAINTAINED]Native AngularJS multiselect directive
http://amitava82.github.io/angular-multiselect
MIT License
140 stars 124 forks source link

c.setClass is not a function #39

Open dud3 opened 10 years ago

dud3 commented 10 years ago

Hi I'm trying to use the injection, but when I try to multiple select items i get the following error: c.setclass is not a function

What might be the problem ?

Thanks

runxc1 commented 10 years ago

You are giving too little information to be of use. Setup a plunkr that demonstrates the error and post a link

dud3 commented 10 years ago

@runxc1 Sorry, ti seems that I can't Setup a plunkr, but I can describe it in more details.

First of all I changed the main templeteURL on the main file to: templateUrl: '/scripts/templates/multiselect.tmpl.html', since it was trying to find it on the same folder of the URL(in this case a PHP MVC controller). After that change it could display the template.

I thought that there was something wrong with my code, then I tried from the examples: JS:

    $scope.cars = [{id:1, name: 'Audi'}, {id:2, name: 'BMW'}, {id:1, name: 'Honda'}];
    $scope.selectedCar = [];
    ...

HTML:

   <multiselect class="input-xlarge" multiple="true"
        ng-model="selectedCar"
        options="c.name for c in cars"
        change="selected()" >
</multiselect>

As a Result I got the following: ex_dropdown_1

The behavior: After Selecting an item the drop-down automatically closed it self, but the scopes were populated and it showed me the the number of selected items, but the only problem was that it didn't assign tick symbols(which probably are the ones of bootstrap).

Error type: c.setClass is not a function

Please let me know if you need further explanation.

amitava82 commented 10 years ago

It could be new version of AngularJS? I'm sorry I've not worked on angular for a long time, not sure if anything changed after 1.2

dud3 commented 10 years ago

@amitava82 That's what exactly I was thinking, my angular version is the latest one, I can't degrade it because I have more than 10 more dependencies, that depend on it, is it OK if I try to fix it this weekend so it will fit with the latest version of angular js, and maybe make a pull request ?

amitava82 commented 10 years ago

Sure that would be great! I've been busy with ReactJS, some help would be nice.

runxc1 commented 10 years ago

I have been using the library with multiple version of Angular 1.2 probably up to 1.2.16 without any issues though I haven't updated past that point.

Here is a plunkr I setup 4 months ago using 1.2.15 http://plnkr.co/edit/prvoHr?p=preview

dud3 commented 10 years ago

@runxc1 true it works with 1.2.16 (my app version) on the plunkr, but acts strangely on my app, wired.

Could it be because on my main configuration i changed the interpolateProvider:

 $interpolateProvider.startSymbol('<*');
 $interpolateProvider.endSymbol('*>');

Because it runs into a conflict with the MVC template engine, since they both use the same syntax {{ }} to render.

amitava82 commented 10 years ago

@dud3 are you using JADE? Don't know if this is related https://github.com/angular/angular.js/issues/6419

dud3 commented 10 years ago

@amitava82 I'm actually using Blade Templating engine, but it might be the similar problem I guess.