angularjs - When I update the action on my form, it doesn't post -


this works fine

<head> <script>         function usersctrl($scope) {             $scope.info = "the buttons haven't been clicked yet";             $scope.signupfolks = function () {             $scope.info = "you've cliked first radio option!"             $scope.actionyo = "/users/session";         };         $scope.loginfolks = function () {             $scope.info = "you've cliked second option!";             $scope.actionyo = "/users/session2";     };     }   </script>  </head>   <body> <div ng-controller="usersctrl"> <form action="/users/session" method="post"> <input type="radio" ng-model="currentfolks" ng-change="signupfolks()" name="newfolks" id="optionsradios1" value="newfolks3"> <input type="radio" ng-model="currentfolks" ng-change="loginfolks()" name="newfolks" id="optionsradios2" value="currentfolks3"> <button type="submit">sign in</button> {{info}} <!-- verifies angular's working example --> </div> 

this breaks it

changing

<form action="/users/session" method="post"> 

to

<form action="{{actionyo}}" method="post"> 

but in "view source" says

when don't have option button selected, says:

<form action method="post"> 

when select option button, source says:

<form action="/users/session" method="post"> 

but when hit submit button... won't go. nothing happens.

i guess because before hit option button, actionyo has no value yet?

try set value first in controller:

function usersctrl($scope) {             $scope.actionyo = "/users/session"; //set default. warning: default want?             $scope.info = "the button haven't been clicked yet";             // rest of code 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -