0
Q:

validacao de campo vazio Toastr js

//arquivo separados
let campos = [{value: this.date, label: "Data"}, {value: this.custo_valor, label: "Custo"}, {value: this.vei_id.id, label: "veículo"}, {value: this.tipo_id.id, label: "condutor"}, ]
        if(this.util.validacao(campos))
//Serviço(utilities)
public validacao(campos)
    {
        let retorno = true;
        campos.forEach((val, i)=>
        {
            if(!val.value)
            {
                this.toastr.warning("Preecha o campo " + val.label + "!");
                retorno = false;
            }
        });
        return retorno;
    }          
                  
0

New to Communities?

Join the community