JSFiddle - React, Tailwind, and code Playground
HTML
<div ng-app="app" ng-controller="MainCtrl">
<a href="{{jsonUrl}}" download="download.json">download</a>
</div>
JavaScript
var app = angular.module("app", []);
app.config( [
'$compileProvider',
function( $compileProvider )
{
$compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|data|chrome-extension):/);
// Angular before v1.2 uses $compileProvider.urlSanitizationWhitelist(...)
}
]);
app.controller("MainCtrl", ["$scope", function($scope) {
var jsobObj = { name: 'Michelle', age: 28 };
var jsonData = "text/json;charset=utf-8," + encodeURIComponent(JSON.stringify(jsobObj));
$scope.jsonUrl = 'data:' + jsonData;
}]);