Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49188

How to make Rest API Basic Authentication with AngularJS?

$
0
0

@abdul0435 wrote:

I am new to ionic framework, i have tried to get the value using Restful API with Basic Authentication. My code is,

        var exampleApp= angular.module('starter', ['ionic']);                                                                                                  exampleApp.controller('ExampleController', function($scope, $http) {
         $scope.getData = function() {
$http.get("http://localhost/smart/api/request/section", { params: { "key1": "value1", "key2": "value2"               } })
        .success(function(data) {
        alert("SUCCESS");
        console.log(data[0]['floor_no']);
        $scope.firstname = data[0]['section'];
        $scope.lastname = data[0]['floor_no'];
    })
    .error(function(data) {
        alert("ERROR");
    });
 }

Above code work fine without authentication rest api, but i need rest api basic authentication.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49188

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>