I have a problem updating a angular chosen select dropdown. This is my code
which inits the dropdown from a json query and then sets the default to
international,
which works fine by setting the ng-model to 'international'.
<select style="width:200px;"
chosen
data-ng-change="setCountryFilter()"
options="countries"
ng-model="selectedCountry"
ng-options="country.value as country.text for country in countries">
<option/>
</select>
function initCountries() {
...
$http.get(searchUrl).success(function(response) {
$scope.countries = response;
$scope.selectedCountry = 'international'; // set default for
country dropdown
});
}
But I have a link on the page and on click it should update the selected
value in the chosen select dropdown by changing it's ng-model once more.
$scope.$apply($scope.setCountry = function() {
$scope.selectedCountry = $scope.cookieCountry;
});
This does not work. I did several approaches with $scope.$apply() and
$scope.$digest() but this was not successfully.
Any idea?
--
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 http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.