So I found something for page submission, but it's not quite working.  This 
is the updated controller:

    app.controller('LoginController', ['$http', '$scope', function($http, 
$scope){
        $scope.formData = {};
        
        // process the form
        $scope.processForm = function(e) {
            
            var formElement = angular.element(e.target);
            
            $http({
                method: "post",
                url: "index.cfm?action=api.login",
                data: $.param($scope.formData),
                headers: {
                    'Content-Type': 'application/x-www-form-urlencoded'
                }
            })
            .success(function(data, status, headers, config) {
                alert('here');
                
                formElement.attr("action", 
"index.cfm?action=encounter.search");
                alert('here');  //break for inspection
                formElement.submit();

            })
            .error(function(data) {
                return false;
            });
        };
    
    }]);


When the alert pops up, I'm seeing the form's action set correctly in 
firebug - but after pressing okay, I'm redirected to the default page 
instead.  Pretty confused.



On Sunday, August 10, 2014 1:58:31 PM UTC-7, Jonathan Price wrote:
>
> Thinking more about this, it begs a larger question.  Is Angular right for 
> me if I'm not building a full, single-page app?  I will want to do many 
> async activities in individual pages, but there will be plenty of form 
> submission-type page changes as well.  Advice appreciated.
>
>
> On Sunday, August 10, 2014 12:48:23 PM UTC-7, Jonathan Price wrote:
>>
>> This is pretty basic, so my apologies if it's tiresome.
>>
>> I've got a form declared as such:
>>
>> <form 
>>       name="loginForm" 
>>       ng-controller="LoginController"
>>       ng-submit="processForm()"
>>       novalidate >
>>
>> with a Controller defined like so:
>>
>>     
>>     app.controller('LoginController', ['$http', '$scope', function($http, 
>> $scope){
>>         $scope.formData = {};
>>
>>         // process the form
>>         $scope.processForm = function() {
>>
>>         $http({
>>             method: "post",
>>             url: "index.cfm?action=api.login",
>>             data: $.param($scope.formData),
>>             headers: {
>>                 'Content-Type': 'application/x-www-form-urlencoded'
>>             }
>>         })
>>             .success(function(data, status, headers, config) {
>>                 return true;
>>             })
>>             .error(function(data) {
>>                 return false;
>>             });
>>         };
>>     
>>     }]);
>>
>> Everything works great.  But what's the best method for sending the user 
>> on to a new page at this point.  I tried declaring the action in the form 
>> tag, but I got a non-descript error from firebug.  Is there a best-practice 
>> for this?
>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to