I am new to angular and am trying to do something pretty simple in vanilla javascript but am unable to find out how to do it properly in angular!
I want to set up a general function to clear an input text field:
I have this html:
<input type="text" ng-model="css" ng-focus="clearInput('css')"/>
(got the ng-focus thing here: https://groups.google.com/forum/?fromgroups=#!topic/angular/A5Lyx8m3S4M it works well!)
and this function in my controller
$scope.clearInput = function (val) {
$scope.val = "";
};
Clearly this would work if I would use $scope.css, but I want to be able use the function for other input fields as well. There's got to be a nice angular way of doing this!!
Thanks!