I have a form with date field, date. In 1a. Once I select a date and click Save, this warning appears in the console:
MyHTML:
<divclass="col-md-12" ng-controller="SaldoCtrl">
<form name="formSaldo" class="formSaldo">
<input class="form-control dataSaldo" type="date" name="dataSaldo" ng-model="saldo.data">
<select class="form-control descricaoSaldo" name="descricaoSaldo" ng-model="saldo.descricao" required>
<option value="">Selecione...</option>
<option value="Caixa">Caixa</option>
<option value="Tesouraria">Tesouraria</option>
<option value="Saldo Bancário">Saldo Bancário</option>
<option value="Diversos">Diversos</option>
</select>
<select class="form-control saldoFormaPgto" name="formaPgto" ng-model="saldo.formaPgto" required>
<option value="">Selecione forma pgto.</option>
<option value="Dinheiro">Dinheiro</option>
<option value="Cheque á vista">Cheque á vista</option>
<option value="Cheque á prazo">Cheque á prazo</option>
<option value="Outros valores">Outros valores</option>
</select>
<input class="form-control saldoValor" type="text" name="valorsaldo" ng-model="saldo.valor" required>
<a class="btn btn-success" ng-disabled="formSaldoBancario.$invalid" ng-click="salvarSaldo(saldo)">Salvar</a>
</form>
</div>
My controller:
app.controller("SaldoCtrl", function ($scope, $http, $window, $rootScope, $filter) {
$scope.salvarSaldo = function(saldo){
if(saldo.data){
var data = $filter('date')(saldo.data, 'yyyy-MM-dd');
saldo.data = data;
}else{
var data = new Date();
var data = $filter('date')(data, 'yyyy-MM-dd');
}
saldo.data = data;
saldo.idempresa = $scope.idempresa;
saldo.opcao = "Adicionar saldo";
console.log(saldo);
}
});