问题
I have this bug that I can't find and I don't know how to fix. I searched how to make the materializecss select work with angularjs. this is the code I found.
function materialSelect($timeout) {
var directive = {
link: link,
restrict: 'E',
require: '?ngModel'
};
function link(scope, element, attrs, ngModel) {
$timeout(create);
if (ngModel) {
ngModel.$render = create;
}
function create() {
element.material_select();
}
//if using materialize v0.96.0 use this
element.one('$destroy', function () {
element.material_select('destroy');
});
}
return directive;
}
But Now, there's bug in every select I have. Sometimes, the select is only 1. the first select don't have any value. the options are inserted in 2nd select. sometimes there's only 1 select and We're praying for that to always happen. When I first used angularjs there's no bug like that. but now that our system is near in completion, that bug shows up
<select id="cREmp123" ng-model="vm.selEmployee"
ng-options="employee.strEmpFirstName for employee in vm.employeeList">
<option value="" selected>Choose...</option>
</select>
来源:https://stackoverflow.com/questions/39647390/materializecss-select-angularjs