guilhermebhte 22 de mai. de 2018
Antes de clicar em salvar
Clicando em salvar
Back end
guilhermebhte 22 de mai. de 2018
guilhermebhte 22 de mai. de 2018
javaflex 23 de mai. de 2018
Imagem fica difícil. Posta o código HTML indicando os elementos que deseja desabilitar.
Exemplo:
HTML:
<input class= "teste" type= "text" />
<input class= "teste" type= "checkbox" value= "Teste" >
<select class= "teste" >
<option> Teste</option>
</select>
JS:
var elems = document . querySelectorAll ( ".teste" );
for ( var i = 0 ; i < elems . length ; i ++ ) {
elems [ i ] . disabled = alterarRegistro ; // sua variavel
}
Solucao aceita
guilhermebhte 28 de mai. de 2018
Foi resolvido.
No código TS, eu estava pegando o form.value e tentando salvar. Mas troquei pela variável declarada no [(ngModel)] . Assim funcionou e não tive mais problemas.
Antes
onSubmit ( form ){
this . loading = true ;
console . log ( form . value );
this . bairro , id = form . id
this . bairro , pais = form . pais
this . bairro . descricao = form . descricao
console . log ( this . bairro );
this . bairroService . getSalvar ( this . bairro ) . map ( res => res )
. subscribe (
dados => {
console . log ( dados );
var tipoRetorno : boolean = false ;
if ( dados . tipo == "SUCESSO" ){
tipoRetorno = true ;
}
this . openSnackBar ( dados . mensagem , tipoRetorno );
if ( dados . tipo == "SUCESSO" ){
this . voltar ();
}
this . loading = false ;
}
), err => {
this . loading = false ;
};
}
Agora
onSubmit ( form ){
this . loading = true ;
console . log ( form . value );
console . log ( this . bairro );
this . bairroService . getSalvar ( this . bairro ) . map ( res => res )
. subscribe (
dados => {
console . log ( dados );
var tipoRetorno : boolean = false ;
if ( dados . tipo == "SUCESSO" ){
tipoRetorno = true ;
}
this . openSnackBar ( dados . mensagem , tipoRetorno );
if ( dados . tipo == "SUCESSO" ){
this . voltar ();
}
this . loading = false ;
}
), err => {
this . loading = false ;
};
}
Obrigado