<强> AngularJS的选择设置默认值强>
在使用角时候使用选择标签时会遇到绑定数据指定默认显示值可这样实现
& lt; !DOCTYPE html> & lt; html ng-app=" noteApp " ng-controller=皀oteCtrl”比; & lt; head> & lt;元http-equiv=肮丶省蹦谌?発eyword1、keyword2 keyword3”比; & lt;元http-equiv=懊枋觥蹦谌?罢馐俏业囊趁妗北? & lt;元http-equiv=? type”内容=" text/html;charset=utf - 8”比; & lt;脚本type=" text/javascript " src=" https://www.yisu.com/plugins/angular.min.js "祝辞& lt;/script> & lt;/head> & lt;身体ng-app=" noteApp " ng-controller=皀oteCtrl”比; & lt;选择ng-options="行为。id为act.name typeList行动” ng-model=" ZNoteVo.type "祝辞& lt;/select> & lt;/body> & lt;脚本type=" text/javascript祝辞 角。模块(“noteApp”, [])。控制器(“noteCtrl”功能(范围美元){ 美元的范围。typeList=[{ id:“01”, 名称:“任务” },{ id:“02”, 名称:“日志” },{ id:“03”, 名称:“会议” },{ id:“04”, 名称:“学习” },{ id:“05”, 名称:“总结” },{ id:“99”, 名称:“其”他 }); 美元scope.ZNoteVo={}; scope.ZNoteVo美元。类型=?3”; }); & lt;/script> & lt;/html> >之前当我们选择类型是03时则默认是会议
感谢阅读,希望能帮助到大家,谢谢大家对本站的支持,如有疑问请留言或者到本站社区交流讨论,大家共同进步。
AngularJS选择设置默认值的实现方法