JSFiddle - React, Tailwind, and code Playground
by vojtajina
HTML
<script src="http://code.angularjs.org/0.10.4/angular-0.10.4.min.js" ng:autobind></script>
<div ng:controller="ErrorCntl">
<select ng:model="data.category"
ng:options="c for c in categories"
ng:change="clearNewCategory()" >
<option value="" > --choose category--</option>
</select><br/>
<input type="text" ng:model="data.newCategory" ng:change="clearCategory()"/>
<br/><br/><br/>
<pre>
categories = {{categories}}
data = {{data}}
</pre>
</div>
JavaScript
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;
}
};