JSFiddle - React, Tailwind, and code Playground

HTML

<div ng-app='myApp'>
    <div ng-controller="ControllerOne">
        <button ng-click="getUserOne()">User One</button>
    </div>
    <div ng-controller="ControllerTwo">
        <button ng-click="getUserTwo()">User Two</button>
    </div>
</div>

JavaScript

var app = angular.module('myApp', []);

app.factory('userFactory', function (){
    return {
        users : [{
                    userId: 1,
                    userName: "Jhonny"
                 },
                 {
                    userId: 2,
                    userName: "Sunny"
                 }
                ]
    }
});

app.controller('ControllerOne', function ($scope, userFactory) {
    $scope.getUserOne = function()
    {
        alert(JSON.stringify(userFactory.users[0]));
    }
    
});

app.controller('ControllerTwo', function ($scope, userFactory) {
      $scope.getUserTwo = function()
    {
        alert(JSON.stringify(userFactory.users[1]));
    }
    
});