AngularJS的select設置默認值

在使用Angular時候使用select標籤時會遇到綁定數據指定默認顯示值可這樣實現javascript

<!DOCTYPE html> html

<html ng-app="noteApp" ng-controller="noteCtrl"> <head> java

<meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="this is my page"> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <script type="text/javascript" src="../plugins/angular.min.js"></script> app

</head> <body ng-app="noteApp" ng-controller="noteCtrl"> <select ng-options="act.id as act.name for act in typeList" ng-model="ZNoteVo.type"></select> 學習

</body> <script type="text/javascript"> angular.module("noteApp", []).controller("noteCtrl", function($scope) { $scope.typeList = [ { id : '01', name : "任務" }, { id : '02', name : "日誌" }, { id : '03', name : "會議" }, { id : '04', name : "學習" }, { id : '05', name : "總結" }, { id : '99', name : "其餘" } ]; $scope.ZNoteVo={}; $scope.ZNoteVo.type = "03"; }); </script> </html> 當咱們選擇類型是03時則默認是會議 ![輸入圖片說明](https://static.oschina.net/uploads/img/201707/03162339_D2LP.png "在這裏輸入圖片標題")ui

相關文章
相關標籤/搜索