Wednesday, April 6, 2016

How to update the view after submitting a form with angularjs?

I got a simple login page working very similar to how the blog example is set up. Except, the view is pretty much all entirely angularjs. Accordingly, the actual http function is:
    
$http({
method : 'POST',
url    : '/users/login',
data   : $scope.formData
      }).success(function(data, status, headers, config) {
            //
        }).error(function() {
            console.log("ERROR")
        });

Which works like expected, but I am not sure how to update the view. I thought that it would similar to the blog example and the route would be updated so to speak, but unfortunately this isn't the case. So how would I update the view so after a successful login it uses the controllers logic and redirect to the right page?

--
Sign up for our Newsletter for updates.
http://cakephp.org/newsletter/signup
 
We will soon be closing this Google Group. But don't worry, we have something better coming. Stay tuned for an updated from the CakePHP Team soon.
 
Like Us on FaceBook https://www.facebook.com/CakePHP
Follow us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: