I have found a lot of questions about this kind of error and I'm exhausted to find solutions that doesn't work to me... Why the "this" is undefined here on the picture?
@Component({
...
})
export class UsuarioCadastroComponent implements OnInit {
usuario = new Usuario();
mostrarBotaoResetarSenha = false;
constructor(
private usuarioService: UsuarioService,
private autenticacaoService: AutenticacaoService,
private menuService: MenuService,
private errorHandler: ErrorHandlerService,
private baseService: BasesService,
private route: ActivatedRoute,
private router: Router) { }
ngOnInit() {
const idUsuario = this.route.snapshot.params['id'];
if (idUsuario) {
this.carregarUsuario(idUsuario);
}
this.popularPickListBasesUsuarios();
}
get isEditando() {
return Boolean(this.usuario.id);
}
carregarUsuario(id: number) {
this.usuarioService.buscarPorId(id)
.then((usuarioJson) => {
this.usuario = usuarioJson;
this.mostrarBotaoResetarSenha = true;
})
.catch(erro => this.errorHandler.handle(erro));
}
Thanks a lot!
UPDATING
At Line 62, just before the line marked by the debugger, the this is defined, as this.usuario and this.mostrarBotaoResetarSenha.
However, at line 64, these all are undefined