JSFiddle - React, Tailwind, and code Playground

by ktoso

HTML

<html><body>
<script src="http://code.angularjs.org/angular-0.10.2.min.js" ng:autobind></script>

<script>
    function ErrorCntl() {
    this.categories = ['two', 'banana', 'capybara'];
    
    this.data = {};
    };
    
    ErrorCntl.prototype = {
    
    clearNewCategory:function() {
      console.log('clearing new category code');
      this.data.newCategory = null;
    },

    clearCategory:function() {
      console.log('clearing selected category code');
      this.data.category = null;
    }
    };
</script>


<div ng:controller = "ErrorCntl">
    <select name="data.category"
            ng:options="c for c in categories"
            ng:change="clearNewCategory()" > 
        <option value = "" > --choose category--</option>
    </select><br/>

    <input type="text" name="data.newCategory" ng:change="clearCategory()"/>
    
    <br/><br/><br/>
    <pre>
    categories = {{categories}}
    data = {{data}}
    </pre>
</div>               
</body></html>