今天又被一个angularjs的一个问题给难住了,有花了比较多的时间去解决
select option ng-repeat多空白项
这文章里讲了怎么解决添加页面的option多出来的问题在修改页面里我也是安装这个方法去处理,但是不行,给ng-model附上值就是显示不了默认值,最后在自己的摸索下解决了这个问题
正确方面
<select ng-model="posts.website" ng-options="c.websites_id as c.websites_name for c in posts.websites" class="form-control" ng-selected="c.websites_id==posts.website"> <option value="">请选择网站</option> </select>游览器解析的代码为
<select ng-model="posts.website" ng-options="c.websites_id as c.websites_name for c in posts.websites" class="form-control ng-pristine ng-valid ng-touched" ng-selected="c.websites_id==posts.website"> <option value="" class="" selected="selected">请选择网站</option> <option label="fdsaffd" value="number:4">fdsaffd</option> <option label="fdsaffdsa" value="number:3">fdsaffdsa</option> <option label="fdsaf" value="number:2">fdsaf</option> <option label="小松博客" value="number:1" selected="selected">小松博客</option> </select>
QQ交流群:136351212
查看原文:http://www.phpsong.com/2005.htmlselected