Here is a question I asked previously, where I was looking to remove negative numbers from an input field:
<input type = "text" ng-model="number"></input>
In that previous question, Paritosh provided me with a helpful solution, but now I am interested in converting that code from a filter to a directive. How can I go about turning it into a directive?
app.filter('nonNegative', function(){
return function(val){
if(val >= 0) return val; else '';
}
})