ng-model在這裏設置,所以我可以通過過濾器進入我的功能,並獲得所有用戶選擇。我想我也可以用它來預先填寫/默認數據。它不工作。這是我的控制器:angularjs - ng-model沒有爲我設置默認值
.controller('ListCtrl', [
'$scope', '$filter', '$location', 'context', 'breeze', 'Service',
function ($scope, $filter, $location, context, breeze, Service) {
$scope.pageLoaded = true;
$scope.lists = [];
$scope.DDL1 = '';
$scope.filter = {
fromDate: '2015-05-01',
toDate: '',
sales: false
};
我有HTML這樣的:
<md-content ng-controller="ListCtrl" layout="column" flex class="md-padding">
<md-tabs class="md-primary clearfix" md-selected="0" flex>
<md-tab label="Lists">
<table><tr>
<td width="10%">From Date: </td>
<td width="40%"><input type="date" ng-model="filter.fromDate" value="{{filter.fromDate}}"/></td>
<td width="10%">SParts: </td>
<td width="40%">
<input type="radio" name="sales" ng-model="filter.sales" value="true"> yes
<input type="radio" name="sales" ng-model="filter.sales" value="false" checked> no
</td>...
也datepicker工作,因爲我設置值= {{}} - 我不想這樣做。不應該ng模型足夠?無線電不管用 –