6
I have a form where I send a query to the current url, through parameters GET
. For example, I have url/teste
, when sending the query via this form, will url/teste?term=minha+consulta
.
I didn’t use Angular
because it was already ready, so the form already existed before.
When I placed the angular, this form stopped making the Submit.
Exemplifying my scenario:
<body ng-app="my_app">
<!-- esse input manda para mesma página uma pesquisa GET, por isso não usei "ACTION" -->
<form id="form-pesquisa">
<input type="search" name="term" />
<button type='submit'>Pesquisar</button>
</form>
<!-- uso esse formulário no Angular -->
<form ng-controller="UserCreateController">
<input type='text' name="email" ng-model="user.email" />
<input type='password' name="password" ng-model="user.password" />
</form>
</body>
I noticed that the angular is adding the classes ng-submitted
in this form when I submit the submission.
I would like to know how I can use a form, within the context of ng-app
, but can make a submission via GET
.
Does angular actually block these requests? How to get around this?
What did you mean by "send to the same page"?
– celsomtrindade
@Celsomtrindade "through GET parameters" in the sequence. I meant that although I use Angularjs, I want to send a common form, via GET, to the current url
– Wallace Maxters
And how is the second form sent? Funny.. because I’ve worked with several Rms on the same page but never had this kind of problem..
– celsomtrindade
@Celsomtrindade the Little Boy answered below. By placing the
action
By referencing the page itself, it started working properly again. I just think the answer should be a little more complete, explaining why this behavior occurred.– Wallace Maxters
@Celsomtrindade the second form works by angular. But the first one should work normally, making a Submit and sending a parameter
GET
to the current url.– Wallace Maxters
It is, but I think, although it worked, it should not be the main reason for this error. You said you send by Angular, but how? Through a Submit button? Where’s the button? Because it’s not inside the form, maybe that’s it.
– celsomtrindade
@Celsomtrindade you may not have understood: I have two forms. The first is to make Submit for PHP (via url with parameters
GET
). The second, with the angle, sending the data via Ajax. The first one stopped working after I started using Angular (i.e., it no longer sends the GET query). I click on his Submit, but it does nothing!– Wallace Maxters
Let’s go continue this discussion in chat.
– Wallace Maxters