Questions tagged «angularjs-select»

12
使用AngularJS从选择选项中删除空白选项
我是AngularJS的新手。我搜索了很多,但是并不能解决我的问题。 我第一次在选择框中得到一个空白选项。 这是我的HTML代码 <div ng-app="MyApp1"> <div ng-controller="MyController"> <input type="text" ng-model="feed.name" placeholder="Name" /> <select ng-model="feed.config"> <option ng-repeat="template in configs">{{template.name}}</option> </select> </div> </div> JS var MyApp=angular.module('MyApp1',[]) MyApp.controller('MyController', function($scope) { $scope.feed = {}; //Configuration $scope.configs = [ {'name': 'Config 1', 'value': 'config1'}, {'name': 'Config 2', 'value': 'config2'}, {'name': 'Config 3', 'value': 'config3'} ]; …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.