JSFiddle - React, Tailwind, and code Playground

by neptune001

HTML

<div ng-app="AppName" ng-controller="OneController">
    {{fileContent}}<hr>{{filec()}}
</div>

JavaScript

angular.module('AppName', []);
 
angular.module('AppName').run(function($rootScope) {
    $rootScope.fileContent = 'no file';
});

angular.module('AppName').controller('OneController', ['$scope', '$rootScope', '$http', function($scope, $rootScope, $http) {
    var getContent = function(filename){ return $http.get('sample.json'); };  
    getContent().then(
            function(data) { 
                $rootScope.fileContent = data.data; 
            }, 
            function(error){ 
                $rootScope.fileContent = 'error';
            }
    );
    $scope.filec = function() { return $rootScope.fileContent; }
    
}]);