redirect to/render html response received after POST request

287 views
Skip to first unread message

Shivani Shinde

unread,
Oct 22, 2019, 7:28:30 AM10/22/19
to Angular and AngularJS discussion
Hi, I am completely new to angular. I need some help in following.
I am uploading a file by calling an api using POST. 
  $scope.uploadFiles = function () {

                var request = {
                    method: 'POST',
                    url: 'my-url',
                   
                                           data: formdata,
                    headers: {
                        'Content-Type': 'multipart/form-data'
                        
                    }
                  };

                // SEND THE FILES.
                $http(request)
                    .success(function (d) {
                        alert(d);
                    })
                    .error(function () {
                    });
            }

In response .success(function(d)), I receive the html script of the page I need to redirect to for google login.(Screenshot of output is attached.) How can redirecting be achieved? How can that html response be handled? 

Screenshot from 2019-10-22 12-58-30.png


sunil patel

unread,
Oct 22, 2019, 7:32:31 AM10/22/19
to ang...@googlegroups.com
Hi shivani,
You can redirect on success response.
Like this.router.navigate([redirecturl]);
Or 
Window.location.href = redirecturl;

--
You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/angular/50ec53d4-25bc-4f12-bcac-aa96c3777d20%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages