OhMad
OhMad

Reputation: 7299

AngularDart - Use Form Action

I am trying to use a form action attribute in AngularDart to redirect to the specified url. In plain html I would do something like this:

<form action="http://localhost:8082" method="GET">
   <select name="q">
        <option value="0">0</option>
        <option value="1">1</option>
        <option value="2">2</option>
        <option value="9">9</option>
      </select>
   <input type="Submit" value="Guess">
</form>

How would I implement this functionality with AngularDart?

Thanks in advance

Upvotes: 2

Views: 272

Answers (1)

G&#252;nter Z&#246;chbauer
G&#252;nter Z&#246;chbauer

Reputation: 658067

In Angular you would instead do the request in code, because form action="..." would reload the application or even another page which usually is not what you want in a single page application (SPA):

<form (ngSubmit)="onSubmit()"

and then post the form in Dart code like shown in the question in Dart: AJAX form submit

I haven't done this myself in years and don't have a full example, but it should get you going.

Upvotes: 4

Related Questions