JSFiddle - React, Tailwind, and code Playground

by Aaron Zhang

HTML

<div ng-app="myApp">
    <div ng-controller="myController">
        <input ng-model="a.hello">
            {{a}}
            {{b}}
            
    </div>
</div>

JavaScript

var app = angular.module('myApp', []);
app.controller('myController', ['$scope', function ($scope) {
    $scope.a = {};
    $scope.b = {hello:'world'};
    $scope.a.hello = $scope.b.hello;
}]);

app.directive('myDirective', [function () {
    return {
        scope: {
            collections: '=',
            menus: '='
        },
        replace: true,
        template: '<div ng-repeat="i in menus" ng-show="show[$index]">{{ i }}</div>',
        link: function (scope, element, attrs) {
            scope.show = {};
            scope.$watchCollection('collections', function (val) {
                scope.show = val;
            });
        }
    };
}]);