This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Update to Angular 1.4 breaks directives that manipulate ngOptions data #13145
Closed
Description
I think there's some subtle difference in the way scopes work between 1.3 and 1.4, but I couldn't find anything in the changelogs.
In 1.3 we use a directive like the following to add data to a select element. We don't put the entire element into the directive, as that breaks the for
attribute, it's also not that easy to handle with ngModel.
module.directive('selectCountry', function () {
return {
restrict: 'A',
scope: true,
link: function ($scope, elem, attrs) {
attrs.ngOptions = 'country.code as country.name for country in countryList | orderBy:"name"';
},
controller: function ($scope, countryList) {
$scope.countryList = [];
countryList.getList()
.then(function(result) {
$scope.countryList = result;
});
}
};
})