Fügen Sie die HTTP-basic-Authentifizierung für das HTTP-GET-in angularjs

Ich habe eine vorhandene angularjs-code, die eine HTTP GET. Extrahiert unten einige relevante code im controller.

    .controller('imptViewCtrl', ['$scope', '$http', 
        function ($scope, $http, ) {
                    var url = $configuration.webroot + '/impt/list?list=testlist';
                    $http.get(url).then(function (response) {
                               tableData = response.data;
                               });
        }]);

Hinzufügen möchte ich, dass HTTP basic authentication " der HTTP-GET. Der Benutzername ist foo und das Passwort ist bar. Wie kann das getan werden?

Vielleicht könnte dies helfen: stackoverflow.com/questions/18877715/... ?

InformationsquelleAutor user781486 | 2015-12-22

Schreibe einen Kommentar