I have a select
element with ng-options
set to a certain expression, using AngularJS. If the options change, then I need to make sure that the jQuery plugin that I'm using for displaying the select
element also refreshes. So, if the options have changed, then I need to make a refresh call.
Does anybody know how to do it?
I will direct you to angular-ui, we have a generic directive ui-jq that may just do what you want. The basic problem is that angular does not know about your jquery plugin making updates to angular's model. Typically, you need to listen for the external event and use $scope.apply let angular know.
I'm not sure if this is what you're asking, but: if you want to watch for models changing, use scope.$watch:
scope.$watch('name', function(newVal) {
// do something with the new value of scope.name
});
But if you're specifically using a select, then definitely check out angular-ui, as Dan Doyon suggested. It has a plugin that should take care of what you need.