这有什么办法吗?这是我的代码
<form class="sky-form" ng-submit="formDataDiri()" name="datadiriForm" novalidate>
<div class="row">
<div class="col col-12"><img src="images/icon_namapasien.png" alt=""/> Nama Pasien</div>
</div>
<div class="row">
<div class="col col-12">
<label class="input disabled" ng-repeat="data in dataDiri">
<input type="text" value="{{data.name}}" placeholder="{{data.name}}" name="name" ng-model="nama" disabled="">
</label>
</div>
</div><!-- /row -->
<div class="row">
<div class="col col-12"><img src="images/icon_tgl.png" alt=""/> Tanggal Lahir</div>
</div>
<div class="row">
<div class="col col-4">
<label class="input disabled" ng-repeat="data in dataDiri">
<input type="text" value="{{data.birth_day}}" placeholder="{{data.birth_day}}" name="name" ng-model="nama" disabled="">
</label>
</div>
<div class="col col-5">
<label class="input disabled" ng-repeat="data in dataDiri">
<input type="text" value="{{data.birth_month}}" placeholder="{{data.birth_month_name}}" name="name" ng-model="nama" disabled="">
</label>
</div>
<div class="col col-3">
<label class="input disabled" ng-repeat="data in dataDiri">
<input type="text" value="{{data.birth_year}}" placeholder="{{data.birth_year}}" name="name" ng-model="nama" disabled="" >
</label>
</div>
</div><!-- /row -->
<div class="row">
<div class="col col-12"><img src="images/icon_gender.png" alt=""/> Jenis Kelamin</div>
</div>
<div class="row">
<div class="col col-12">
<div class="select">
<label class="select">
<select name="JKelamin" ng-model="jeniskelamin" required="">
<option value="">Pilih Jenis Kelamin</option>
<option value="1">Pria</option>
<option value="0">Wanita</option>
</select>
<i></i>
</label>
</div>
</div>
</div><!-- /row -->
<div class="row">
<div class="col col-12"><img src="images/icon_alamat.png" alt=""/> Alamat</div>
</div>
<div class="row">
<div class="col col-12">
<label class="input disabled">
<input type="text" value="" ng-model="alamat" name="address" required=""/>
<input type="hidden" name="name" value="0" ng-model="kodekota">
</label>
</div>
</div><!-- /row -->
<div class="row">
<div class="col col-12"><img src="images/icon_telp.png" alt=""/> Nomor Telepon / Hp</div>
</div>
<div class="row">
<div class="col col-12">
<label class="input disabled">
<input type="text" value="" ng-model="notelp" name="hp" required="" minlength="6" maxlength="13"/>
</label>
</div>
</div><!-- /row -->
<div class="row">
<div class="col col-12"><img src="images/icon_layanan.png" alt=""/> Layanan</div>
</div>
<div class="tabform">
<ul class="tabs" ng-model="layanan">
<li class="tab-link" data-tab="tab-1" ng-click="homeservice()"> <span class="homeservice">Home Service</span></li>
<li class="tab-link current" data-tab="tab-2" ng-click="periksalab()"><span class="periksalab">Periksa di Lab</span></li>
</ul>
<div id="tab-1" class="tab-content">
<div class="row">
<div class="col col-12"><img src="images/icon_tgl.png" alt=""/> Tanggal Pemeriksaan</div>
</div>
<div class="row">
<div class="col-md-12">
<label class="input disabled">
<input type="text" ng-model="hs" class="datepicker1" />
</label>
</div>
<!-- <div class="col col-4">
<label class="select">
<select name="tanggalPeriksaHS" ng-model="dateperiksa" required="">
<option value="">Tanggal</option>
<option ng-repeat="n in range(1,31)" value="{{n}}">{{n}}</option>
</select>
<i></i>
</label>
</div>
<div class="col col-5">
<label class="select">
<select name="bulanPeriksaHS" ng-model="monthperiksa" required="">
<option value="">Bulan</option>
<option value="01">Januari</option>
<option value="02">Februari</option>
<option value="03">Maret</option>
<option value="04">April</option>
<option value="05">Mei</option>
<option value="06">Juni</option>
<option value="07">Juli</option>
<option value="08">Agustus</option>
<option value="09">September</option>
<option value="10">Oktober</option>
<option value="11">November</option>
<option value="12">Desember</option>
</select>
<i></i>
</label>
</div>
<div class="col col-3">
<label class="select">
<select name="tahunPeriksaHS" ng-model="yearperiksa" required="">
<option value="">Tahun</option>
<option value="2016" selected>2016</option>
</select>
<i></i>
</label>
</div> -->
</div><!-- /row -->
<div class="row">
<div class="col col-12"><img src="images/timeperkiraan.png" alt=""/> Perkiraan Jam Home Service</div>
</div>
<div class="row">
<div class="col col-12">
<label class="select disabled">
<select data-ng-options="h.id as h.time for h in dataHomeService.home_service_time" name="gender" ng-model="jamlayanan">
</select>
<i></i>
</label>
</div>
</div><!-- /row -->
<div class="row">
<div class="col col-12"><div class="smallprice">Tambahan biaya home service Rp <span>0.00</span></div></div>
</div>
</div>
<div id="tab-2" class="tab-content current">
<div class="row">
<div class="col col-12"><img src="images/icon_tgl.png" alt=""/> Tanggal Pemeriksaan</div>
</div>
<div class="row">
<label class="input disabled">
<input type="text" ng-model="periksa" class="datepicker2" />
</label>
<!-- <div class="col col-4">
<label class="select">
<select ng-model="dateperiksa" required="" name="tanggalPeriksaPL">
<option value="">Tanggal</option>
<option ng-repeat="n in range(1,31)" value="{{n}}">{{n}}</option>
</select>
<i></i>
</label>
</div>
<div class="col col-5">
<label class="select">
<select ng-model="monthperiksa" required="" name="bulanPeriksaPL">
<option value="">Bulan</option>
<option value="01">Januari</option>
<option value="02">Februari</option>
<option value="03">Maret</option>
<option value="04">April</option>
<option value="05">Mei</option>
<option value="06">Juni</option>
<option value="07">Juli</option>
<option value="08">Agustus</option>
<option value="09">September</option>
<option value="10">Oktober</option>
<option value="11">November</option>
<option value="12">Desember</option>
</select>
<i></i>
</label>
</div>
<div class="col col-3">
<label class="select">
<select ng-model="yearperiksa" required="" name="tahunPeriksaPL">
<option value="">Tahun</option>
<option value="2016" selected>2016</option>
</select>
<i></i>
</label>
</div> -->
</div><!-- /row -->
</div>
</div><!-- /tabform -->
<hr class="lineform" />
<button class="btn-yellow" type="submit" name="submit" ng-disabled="datadiriForm.$error.required">Lanjutkan Pemeriksaan</button>
<span ng-show="datadiriForm.$error.required"><center>Mohon mengisi dengan lengkap terlebih dahulu</center></span>
</form>
这是我发布的角度代码:
$scope.formDataDiri = function(){
alert($scope.nama);
if($scope.layanan == '0'){
$http({
method: 'POST',
url: '/api/v1/order/datadiri',
data:{
nama_pasien: $scope.nama,
birth: $scope.year + "-" + $scope.month + "-" + $scope.date,
gender: $scope.jeniskelamin,
address: $scope.alamat,
city_code: "0",
phone: $scope.notelp,
service: $scope.layanan,
//test_date: $scope.yearperiksa + "-" + $scope.monthperiksa + "-" + $scope.dateperiksa,
test_date: $scope.hs,
service: $scope.layanan,
test_date_day: $scope.dateperiksa,
test_date_month: $scope.monthperiksa,
test_date_year: $scope.yearperiksa,
home_service_times: $scope.jamlayanan,
code: $scope.survey,
jawaban: $scope.lainnya
}
}).success(function(data,status){
$scope.dataPasien = data;
//alert($scope.nama);
$window.location.href = 'doctor/order/lab';
});
}else{
$http({
method: 'POST',
url: '/api/v1/order/datadiri',
data:{
nama_pasien: $scope.nama,
birth: $scope.year + "-" + $scope.month + "-" + $scope.date,
gender: $scope.jeniskelamin,
address: $scope.alamat,
city_code: "0",
phone: $scope.notelp,
service: $scope.layanan,
//test_date: $scope.yearperiksa + "-" + $scope.monthperiksa + "-" + $scope.dateperiksa,
test_date: $scope.periksa,
service: $scope.layanan,
test_date_day: $scope.dateperiksa,
test_date_month: $scope.monthperiksa,
test_date_year: $scope.yearperiksa,
home_service_times: $scope.jamlayanan,
code: $scope.survey,
jawaban: $scope.lainnya
}
}).success(function(data,status){
$scope.dataPasien = data;
//alert($scope.nama);
$window.location.href = 'doctor/order/lab';
});
}
感谢您帮助我。
答案 0 :(得分:0)
我在控制器中没有看到您使用$scope.data
的任何位置,请将ng-repeat
中的视图替换为dataPasien
。
<label class="input disabled" ng-repeat="dataPasien in dataDiri">
<input type="text" value="{{dataPasien.name}}" placeholder="{{dataPasien.name}}" name="name" ng-model="nama" disabled="">
</label>