Empty first element in dropdown list

后端 未结 6 2076
花落未央
花落未央 2020-12-25 10:59

I am quite a beginner with AngularJS and currently I am working on a web application in Django where I use AngularJS for the frontend part i can say. My problem is that the

6条回答
  •  南方客
    南方客 (楼主)
    2020-12-25 11:33

    The Blank empty option on top of drop down will appear if you have set ng-model with some value which is not contained in the list options created after the ng-Repeat. Now if you consider the original post and remove the ng-model or set some valid value in ng-model, it will work fine or you can set selected first item as

    $scope.list_category = $scope.list_categories.data[0].id;
    

提交回复
热议问题