Javascript 如何将此默认时间设置为ng repeat中的a.ast? var-app=angular.module('myApp',[]); 应用程序控制器('myCtrl',函数($scope){ $scope.a={}; $scope.b={}; $scope.a.ast=new Date(new Date().toDateString()+“”+'09:30'); $scope.a.bst=新日期(new Date().toDateString()++''+'08:30'); $scope.b.bst=新日期(新日期().toDateString()++''+'07:30'); });
如何将此默认时间设置为ng repeat中的a.ast 如何将ng repeat中的默认时间设置为Javascript 如何将此默认时间设置为ng repeat中的a.ast? var-app=angular.module('myApp',[]); 应用程序控制器('myCtrl',函数($scope){ $scope.a={}; $scope.b={}; $scope.a.ast=new Date(new Date().toDateString()+“”+'09:30'); $scope.a.bst=新日期(new Date().toDateString()++''+'08:30'); $scope.b.bst=新日期(新日期().toDateString()++''+'07:30'); });,javascript,angularjs,Javascript,Angularjs,如何将此默认时间设置为ng repeat中的a.ast 如何将ng repeat中的默认时间设置为a.ast 你想要这个吗 var-app=angular.module('myApp',[]); 应用程序控制器('myCtrl',函数($scope){ $scope.alphabet=[{bst:'',ast:''}]; $scope.b={}; $scope.ast=new Date(new Date().toDateString()++'+'09:30'); $scope.bst=新日期
a.ast
你想要这个吗
var-app=angular.module('myApp',[]);
应用程序控制器('myCtrl',函数($scope){
$scope.alphabet=[{bst:'',ast:''}];
$scope.b={};
$scope.ast=new Date(new Date().toDateString()++'+'09:30');
$scope.bst=新日期(新日期().toDateString()++''+'08:30');
$scope.b.bst=新日期(新日期().toDateString()++''+'07:30');
});代码>
您到底想要什么?您希望在a.ast中指定哪个默认时间?字母表中的数据是什么?$scope.a.ast=new Date(new Date().toDateString()++'+'09:30');我已经改变了密码,现在它清楚了。。。我只想将默认时间09:30设置为与b.bst相同的a.ast,但我无法设置它,因为“a”在ng-repeat中。可能是因为名称“a”与范围上定义的另一个“a”冲突吗?如果你使用另一个名字,比如字母表中的z(并更改ng repeat的内容)对不起,jenny,我更改了代码,你能再次看到它吗,现在很简单,只是想将时间设置为a.astelement@RaaZuSaH你想设定什么时间?这个默认时间是什么意思?很高兴帮助你@拉祖萨
<!DOCTYPE html>
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js">
</script>
<body>
<div ng-app="myApp" ng-controller="myCtrl">
<div ng-repeat="a in alphabet">
<input type="time" ng-model="a.bst">
<input type="time" ng-model="a.ast">
</div>
<input type="time" ng-model="b.bst" >
</div>
<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
$scope.a={};
$scope.b={};
$scope.a.ast = new Date (new Date().toDateString() + ' ' + '09:30');
$scope.a.bst = new Date (new Date().toDateString() + ' ' + '08:30');
$scope.b.bst = new Date (new Date().toDateString() + ' ' + '07:30');
});
</script>
<p>how do i set this default time to a.ast which is in the ng-repeat?</p>
</body>
</html>