I'm trying to send form with dynamically changing action url, but right after changing attribute the form doesn't submits.
Here is simple example: http://jsfiddle.net/THZHL/1/
<div ng-app="app">
<form name="b" action="{{url}}" methood="post" ng-controller="formCtrl">
<button type="button" ng-click="set()">1. set url</button>
<button type="submit">2. Send</button>
{{url}}
</form>
</div>
<script>
app = angular.module("app", []);
app.controller("formCtrl", function($scope){
$scope.set = function(){
$scope.url = "/abc";
}
});
</script>
I don't understand why it happens in that way.
I found the solution!
$scope.url should be set with any non-empty value. Like there:
http://jsfiddle.net/THZHL/2/
app.controller("formCtrl", function($scope){
$scope.url = "/def";
$scope.set = function(){
$scope.url = "/abc";
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With