JSFiddle - React, Tailwind, and code Playground

by paulmc

HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.6/angular.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.6/angular-resource.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.6/angular-route.min.js"></script>
<script src="//rawgithub.com/intermine/CDN/master/js/flot/0.7/jquery.flot.min.js"></script>
<script src="//rawgithub.com/intermine/CDN/master/js/flot/0.7/jquery.flot.pie.min.js"></script>
<body data-ng-app="Overview" data-ng-controller="OverviewCtrl">
    <main>
        <div class="chart-title">{{getCount.count}} Total Transactions</div>
        <div id="deposits" data-chart="pie" data-flot-chart data-ng-model="model">
            <p>Pie chart should display here.</p>
        </div>
    </main>
</body>

CSS

body {
    font-family: verdana;
}
[data-chart] {
    height: 300px;
    width: 300px;
}
p {
    background: #d3d3d3;
    padding: 1em 0;
    text-align: center;
}

JavaScript

;(function (angular, $) {
    //'use strict';

    angular.module('Overview', ['services.DepositsSvc', 'directives.FlotCharts'])

        .controller('OverviewCtrl', ['$scope', 'DepositCount', 'DepositCountGET', function ($scope, DepositCount, DepositCountGET) {

        $scope.getCount = DepositCount.get();

        $scope.getGETCount = DepositCountGET.get();

        $scope.model = {};

        $scope.model.data = [{
            label: 'Gets',
            data: $scope.getGETCount.count,
            //data: 140, // hard-coded values work fine
            color: "#e4d672"
        }, {
            label: 'Puts',
            data: $scope.getCount.count,
            //data: 220, // hard-coded values work fine
            color: "#c2cfeb"
        }];

        $scope.model.options = {
            series: {
                pie: {
                    show: true,
                    radius: 1,
                    label: {
                        radius: 2 / 3,
                        formatter: function (label, series) {
                            return '<div class="pie">' + label + ': ' + series.data[0][1] + '<br>(' + Math.round(series.percent) + '%)</div>';
                        }
                    }
                }
            },
            legend: {
                show: false
            }
        };
    }])

        .config(['$httpProvider', function ($httpProvider) {
        $httpProvider.defaults.useXDomain = true;
        delete $httpProvider.defaults.headers.common['X-Requested-With'];
    }]);

    angular.module('services.DepositsSvc', ['ngResource'])

        .factory('DepositCount', ['$resource', function ($resource) {
        /*return $resource('//raw.github.com/pmccaughtry/angularjs-flotcharts/master/sample-data/put.json', {}, {
                query: { method: 'GET', params: {}, isArray: true }
            });
            */
        return { // custom get methods work fine
            get: function () {
                return {
                 ...