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.factory("myProvider", function() {
    console.log("Factory function called.");
    return new function() { // INLINED our object constructor
        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()
});