18
rated 0 times
[
20]
[
2]
/ answers: 1 / hits: 15181
/ 8 Years ago, mon, january 2, 2017, 12:00:00
im getting json object from the api , in that object one field is encoded with base 64 format. after getting the response i need to decode the base64 data and need to show in the plain text.
sample data
{id:33132,dataFormat:TEVOOjA=}//base64 to ascii i.e LEN:0
desired output - LEN:0
<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function ($scope, $http) {
$http.get('url', {
headers: { 'Authorization': 'Basic a2Vybyt==' }
})
.then(function (response) {
$scope.names = response.data;
$scope.EncodedData = names.dataFrame;
$scope.decodedFrame = atob(EncodedData);
});
});
</script>
<h2>{{names.decodedFrame }}</h2>
More From » angularjs