2
I’m making an application where I register a new company, I’m starting in java script and I’m also using Angular in my project. What I want to do is, when the user clicks to register, give a success message and then return to the homepage, I tried with Alert, but I don’t know how to make the message appear only after the registration is successfully performed.
This is my form :
<form role="form" name="formCadastroEmpresa" ng-submit="formCadastroEmpresa.$valid && cadastrarEmpresa()" novalidate>
I need to call the message submit="formCadastroEmpresa.$valid && cadastrarEmpresa()"
is true, and before calling the cadastrarEmpresa()
of the angular I need to give an alert, or anything of the kind to warn the user that everything went right.
An example form group I’m using:
<div class="form-group" ng-class="{ 'has-error' : formCadastroEmpresa.empresaTelefone.$touched && formCadastroEmpresa.empresaTelefone.$invalid }">
<label>Telefone</label>
<input
minlength="13"
name="empresaTelefone"
class="form-control"
id="telefone"
placeholder="Telefone fixo"
ng-model="empresa.telefone" required>
</div>
<p ng-show=" formCadastroEmpresa.$submitted && formCadastroEmpresa.empresaTelefone.$invalid" style="color:red">Um telefone para contato é necessário</p>
Thank you very much for the reply, I will add to my code, thanks friend.
– William Cézar
Good luck and good studies @Williamcézar
– DiegoAugusto