2

I'm using django in the back-end. I need to submit a form with a language parameter and refresh the page to change the language in the front-end.

I've got a select tag which is nested inside a form.

<form>
   ...
   <select name="language" ng-model="selectedLanguage" ng-options="language in languages" ng-change="changeLanguage()">
   ...
</form>

I'd like to submit the form on select change event, what's the best way to do it with angularjs?

The $event object is not available for the change event (angular 1.3.0).

3
  • 2
    Why don't you use AJAX instead of submitting the form? Commented Apr 24, 2014 at 14:50
  • The back-end is in django and the translations are rendered via django trans tags Commented Apr 24, 2014 at 14:53
  • I think you should mention something how you are using django in your question. Commented Apr 24, 2014 at 14:56

1 Answer 1

1

Have a $scope.$watch for selectedLanguage and call the submit function whenever it changes.

Edit

In case you want to do form submit

you can use angular.element.find to find your form. ( But im not sure why you need angular in case you are making a form submit)

Sign up to request clarification or add additional context in comments.

1 Comment

That's what ng-change does right now. I'd like to know how to make a reference to the form which is inside the controller to submit it manually, I cannot make an ajax call in this case.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.