Im trying to make a directive that wraps around select
with a hard-coded list
var app = angular.module('dirApp',[]);
app.directive('dir', [function(){
return{
restrict: 'E',
template: "<select ng-options='x for x in vm.arr'></select>",
controllerAs: 'vm',
link: function(scope) {
scope.arr=["a", "b"];
}
};
}]);
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<div ng-app="dirApp">
<dir></dir>
</div>
As you can see for some reason the list does not get populated with values. What am I doing wrong?