JSFiddle - React, Tailwind, and code Playground

by fredrik

HTML

<div data-ng-app>
    <div data-ng-controller="BenderCtrl">
        <h1>{{ label }}</h1>
        <button data-ng-click="hide()">Hide forms</button>
        <div data-ng-show="form_1">
            Form 1
        </div>
        <div data-ng-show="form_2">
            Form 2
        </div>
    </div>
</div>

JavaScript

function BenderCtrl($scope) {
    $scope.label = 'Hello, earth!';
    $scope.form_1 = true;
    $scope.form_2 = true;
    
    $scope.hide = function () {
        $scope['form_' + 1] = false;
        eval('$scope.form_' + 1 + '=false;');               
    }
}