-
Notifications
You must be signed in to change notification settings - Fork 129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multi-select disappears when adding ng-model attribut #139
Comments
Hi again, I figured out my problem with a colleague, in the code of the librairie we can found this directive : .directive("materialSelect", ["$compile", "$timeout", function ($compile, $timeout) {
return {
link: function (scope, element, attrs) {
if (element.is("select")) {
function initSelect() {
element.siblings(".caret").remove();
scope.$evalAsync(function() {
element.material_select();
});
}
$timeout(initSelect);
if (attrs.ngModel) {
scope.$watch(attrs.ngModel, initSelect);
}
if ("watch" in attrs) {
scope.$watch(function () {
return element[0].innerHTML;
}, function (oldVal, newVal) {
if (oldVal !== newVal) {
$timeout(initSelect);
}
});
}
}
}
};
}]); By removing the lines below, the multiple select works perfectly : if (attrs.ngModel) {
scope.$watch(attrs.ngModel, initSelect);
} I hope that will help. Regards. BUNLON Steve |
Thanks man. I've created a pull request here. https://github.com/krescruz/angular-materialize/pull/143/commits Regards, |
I'm closing this issue, since it has now been fixed in #143. If you don't think it has been fixed, comment/reopen the issue. |
I need to read the issue before closing it. Reopened. |
Hey there ! I'm facing a problem with material-select and multiple.
On a select input, I'm using ng-options, material-select, and multiple. The problem is that when I click on an item, the dropdown disappears as a normal select (without the multiple). The item is well checked but if I want to click on another one, I have to open again the dropdown. And I found that if I remove the ng-model attribut, it works fine, but I need it !
If someone could work on it or help me !
Great job on this framework BTW.
Steve.
The text was updated successfully, but these errors were encountered: