JSFiddle - React, Tailwind, and code Playground

by marcolepsy

HTML

<div ng-app="app">
    <div ng-controller="Ctrl">
        <my-template></my-template>
    </div>
    
    <!-- my-template.html -->
    <script type="text/ng-template" id="my-template.html">
        <label ng-click="test(rsBlah)">Click</label>
    </script>
</div>

JavaScript

angular.module('app', [])
    .controller('Ctrl', function Ctrl1($scope,  $rootScope) {
        $rootScope.blah = 'Hello';
        $rootScope.yah = 'World'
    })
    .directive('myTemplate', function() {
        return {
            restrict: 'E',
            templateUrl: 'my-template.html',
            scope: {},
            controller: ["$scope", "$rootScope", function($scope, $rootScope) {
                
                $scope.rsBlah = $rootScope.blah;
                
                $scope.test = function(arg) {
                    console.log(arg);
                }
            }]
        };
    });