Hi,
I have created an application. This application uses angularjs for the
model. I have also got a multi select list that uses the chosen plugin. I
can update the angularjs model from the user interface. However, I am not
able to update the UI from the angularjs model. I have a directive with the
following code.
app.directive('chosen', function ($timeout) {
var linker = function (scope, element, attr) {
scope.$watch('item.BusTypeListOptions', function () {
$timeout(function () {
element.trigger('chosen:updated');
}, 0, false);
}, true);
$timeout(function () {
element.chosen();
}, 0, false);
};
return {
restrict: 'A',
link: linker
};
});
I thought the $scope.$watch would update the UI from the model but it does
not seem to. The control has the attribute chosen and looks like below.
<select name="BusType" ng-class="(errorsOn && formInserts.BusType.$invalid)
? 'lh-invalid' : 'na' " chosen="" required
ng-model="item.BusTypeListOptions" id="countries"
ng-options="country.SelectText for country in item.BusTypeDropdownFields"
data-placeholder="Please Select..." multiple="" class="span chzn-select"
style="width: 150px"></select>
Any help would be really appreciated.
Best regards,
Seamus
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.