JSFiddle - React, Tailwind, and code Playground

HTML

<div ng-app="myExample" ng-controller="myCtrl as Ctrl">
    <h2>ngIf example</h2>
    
    <div ng-if="Ctrl.show">
        <input type="text" ng-model="Ctrl.word" placeholder="先打點字在這..." />
        <div>在 ngIf 中有: “{{Ctrl.word}}”</div>
    </div>
    <button ng-click="Ctrl.toggle()">toggle</button>
    <div>按了按鈕後原本 input 裡的東西會不見...</div>    
</div>

JavaScript

var app = angular.module('myExample', []);
app.controller('myCtrl', function ($scope){
    var ctrl = this;
    ctrl.show = true;
    ctrl.word;
    ctrl.toggle = function () {
        ctrl.show = !ctrl.show;
    }
})