Nguyễn Bảo Dũng
Nguyễn Bảo Dũng

Reputation: 245

How to use ng-repeat in select angularjs

I have data like this :

 $scope.data = [
    {
      }
]

How can i repeat it in select . I tried

 <select>
      <option  
      ng-repeat="d in data" value=" {{d.last_name.value}}{{d.first_name.value}}">
        {{d.last_name.value}}{{d.first_name.value}}
     </option>
    </select>

but not work . Here is plnkr : http://plnkr.co/edit/GHSbBh9ddCiSFZZeKAQv?p=preview Please help me

Upvotes: 1

Views: 52

Answers (1)

Olezt
Olezt

Reputation: 1738

You need to inject $scope to your controller like this: function ctrl($scope) {
Working plunkr

Upvotes: 4

Related Questions