JSFiddle - React, Tailwind, and code Playground

by Krzysztof Safjanowski

HTML

<div ng-app="app">
    <div ng-controller="firstCtrl">
        <p>x: {{ x }}</p>
        <p>y: {{ y }}</p>
    </div>
    <div ng-controller="secondCtrl">
        <p>x: {{ x }}</p>
        <p>y: {{ y }}</p>
    </div>
    
</div>

JavaScript

angular.module('app', []).service('testService', function() {
    var testService = {};
    testService.x = 'x';
    testService.y = 'y';
    return testService;
}).controller('firstCtrl', function($scope, testService) {
    $scope.x = testService.x
    $scope.y = testService.y
}).controller('secondCtrl', function($scope, testService) {
    $scope.x = testService.x
    $scope.y = testService.y
})