ng-blur, ng-focus

by Danish Farman

HTML

<div ng-app 
ng-init="focus=false;blur=false;active=false">
<input type="text" 
    ng-class="{ myFocus: focus, myBlur: blur }"    
    ng-focus="focus=true;blur=false;" 
    ng-blur="blur=true;focus=false;">
    <p>focus: {{focus}}</p>
    <p>blur: {{blur}} </p>
</div>

CSS

input[type="text"].myFocus {  
            background-color: yellow;  
        }  
    input[type="text"].myBlur {  
            background-color: red;  
        }