3
Hello, I have this following modal, whenever I click on the button "Refused sale" it opens, however I wanted to close this same modal every time he clicked on the button "Send", that in the case is my Submit, how I do it?
<div class="chat-form">
    <button data-toggle="modal" href="#redModal"  class="btn btn-block red">Recusou venda</button>
  </div>
<!-- Modal info adicionais -->
<div id="redModal" class="modal fade" role="dialog">
  <div class="modal-dialog modal-dialog">
      <!-- Modal content-->
      <div class="modal-content">
          <div class="modal-header">
              <button type="button" class="close" data-dismiss="modal">×</button>
              <h4 class="modal-title"> <i class="fa fa-checker"></i> Recusou</h4>
          </div>
          <div class="modal-body text-center">
              <h3 class="blue-hoki">Recusou a venda</h3>
              <br>
              <form [formGroup]="rForm" (ngSubmit)="recusouVenda(rForm.value)">
                  <div class="row form-modal">
                      <div class="form-group col-md-12">
                          <label>Comentario:
                              <div class="input-group">
                                  <textarea [value]="valorInput" cols="30" rows="10" class="form-control" type="text" formControlName="comentario"></textarea>
                              </div>
                          </label>
                      </div>
                      <br><br><br>
                      <button type="submit" class="btn btn red">Enviar</button>
                  </div>
              </form>
          </div>
      </div>
  </div>
</div>
You have to post your complete code, with Javascript as well. But it would give a preventDefault on the button Submit and put the close function inside the Submit event.
– Lucas de Carvalho
i don’t use javascript at anything of modal
– Marcelo Henrique Dos Reis
When you click "send" the page is not submitted (reloaded)?
– Sam
The design is angled, so nothing is reloaded
– Marcelo Henrique Dos Reis
I couldn’t understand your question, it seems a little vague, I tested your code and when I click to send it closes normally.
– Phill
There is no way to make it close by javascript or something not?
– Marcelo Henrique Dos Reis
But if you’re using Angular, don’t just go into the Typescript file of the component that created the modal and instantiate the method close-up()??
– LeAndrade
That is not another Component, and in the same
– Marcelo Henrique Dos Reis
Indifferent to where he created the modal, he could put his ts also in the question.
– LeAndrade
but there is literally nothing in my ts, it works by itself, only and exclusively in html
– Marcelo Henrique Dos Reis
Well, I don’t quite understand how you did it, but it wouldn’t be enough to just add this data-Dismiss="modal" on the send button??
– LeAndrade
Which version of Bootstrap are you using? I believe doing what @Leandrade said was right!
– hugocsl