JSFiddle - React, Tailwind, and code Playground

by jhoguet

HTML

<h1>Proving that both .service and .factory can return an object </h1>
<div ng-app="ServiceTestApp">
    <ul ng-controller="ServiceTestController">
        <li>{{simpleService.result}}</li>
    </ul>
</div>

JavaScript

var app = angular.module('ServiceTestApp', [])
.controller('ServiceTestController', ['$scope', 'simpleService',function ($scope, simpleService) {
    $scope.simpleService = simpleService;
}]);

app.provider('simpleService',function(){
    this.$get = function($http){
        console.log($http)
        return {
            result : 'from simpleService'
        };
    };
});