0
이것은 내 코드입니다. DOM은 AggiungiProdotto()
함수를 호출 한 후 input radio[name="Dispense"]
에 대해 undefined
을 반환합니다.입력 라디오의 바인딩 값을 ng-repeater에 webSql 데이터베이스에 바인딩
HTML 부분 :
<ons-list ng-controller="ListaDispense">
<ons-list-header>Seleziona Dispensa</ons-list-header>
<ons-list-item modifier="tappable" ng-repeat="item in items" ng-repeat="item in items">
<label class="radio-button radio-button--list-item">
<input type="radio" name="Dispense" id="{{item.id}}" ng-model="IdDispensa" ng-value="{{item.id}}">
<div class="radio-button__checkmark radio-button--list-item__checkmark"></div>
{{item.NomeDispensa}}
</label>
</ons-list-item>
</ons-list>
자바 스크립트 부분
$scope.AggiungiProdotto = function() {
var t = $scope.IdDispensa; //$("input[name=Dispense]:checked").val();
var n = $scope.nomeProdotto; //$("#nomeProdotto").val();
var d = $scope.DataScadenza; //$("#DataScadenza").val();
var g = $scope.GiorniPreavviso; //$("#GiorniPreavviso").val();
if(n==undefined || t == undefined){
ons.notification.alert({message: 'Inserisci il nome del prodotto e/o categoria!'});
return false;
}
else{
dbRemindUse.transaction(function(e) {
var i = "INSERT INTO prodotti (nome, iddispense, datascadenza, giornipreavviso) VALUES (?, ?, ?, ?)";
e.executeSql(i, [n, t, d, g], function() {
ons.notification.alert({message: 'Prodotto Inserito'});
}, error)
})
}
};
보이는를 이해하기위한 10 초 나를 이길처럼 ... 나는 내 대답은 삭제됩니다 –
하하 미안 :-) 답변이 좋기를 바랍니다. – squiroid
안녕하세요, 도와 주셔서 감사합니다, 나는 첫 번째를 사용합니다 : 하지만 결과는이 스크립트의 $ scope var t = $ scope.IdDispensa에 대해"undefined "입니다. – user1969503