JSFiddle - React, Tailwind, and code Playground

by Luis Perez

HTML

<div ng-controller="MyController"></div>
<div ng-controller="MyController2"></div>

JavaScript

var mod = angular.module("MyModule", []);

mod.service("myProvider", function() { // CHANGED "factory" to "service"
    // NOTE that the only function being passed is the object constructor from before
    this.getValue = function() {
        return "My Value";
    };
});

mod.controller("MyController", function(myProvider) {
    console.log("MyController - myProvider: " + myProvider.getValue()); // CHANGED to call getValue()
});

mod.controller("MyController2", function(myProvider) {
    console.log("MyController2 - myProvider: " + myProvider.getValue()); // CHANGED to call getValue()
});