JSFiddle - React, Tailwind, and code Playground

HTML

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

JavaScript

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