JSFiddle - React, Tailwind, and code Playground

by KARTHIKEYAN K

JavaScript

(function () {

    angular.module('MainApp', []);

    //mainController

    /**
* @ngInject
*/
    function mainController(AnotherService) {
        var vm = this;
        vm.title = 'Home';
        vm.greetings = [];
        activate();
        function activate() {
            return AnotherService.someMethod().then(function (data) {
                vm.greetings = data;
                console.log(vm.greetings);
                console.log(JSON.stringify(vm.greetings));
                return vm.greetings;
            })
        }
    }
    angular.module('MainApp')
   .controller('mainController', mainController); flex - bridge
    mainController.$inject = ['AnotherService'];

    //AnotherService

    /**
 * @ngInject
 */
    function AnotherService($http) {
        var AnotherService = {};
        AnotherService.someMethod = function () {
            return $http.get('https://jsonplaceholder.typicode.com/users').then(function (response) {
                return response.data;
            })
        }

        return AnotherService;
    }

    angular.module('MainApp')
     .factory('AnotherService', AnotherService);
    AnotherService.$inject = ['$http'];

})();