Hi,
Thanks....
ngFocus-
As the
focus
event is executed synchronously when calling input.focus()
AngularJS executes the expression using scope.$evalAsync
if the event is fired
during an $apply
to ensure a consistent state.
Here, is an example in which if an user focus on an input box an message will be show down of that input box.
So, following lines of code, we will add in the style.css file.
.focus { border-left: 5px solid green !important; background-color: lightgreen; }
In home.html file we will add following lines of code-
<ion-view><ion-content>
<div class="container"> <div ng-init="Array = ['List 1','List 2','List 3']"> <h3>Example of Ng-Focus</h3> <div ng-repeat="array in Array"> <input type="text" class="form-control" ng-model="array" autofocus ng-class="{true:'focus',false:'blur'}[isFocused]" ng-focus="isFocused=true" ng-blur="isFocused=false"> <span ng-show="isFocused"><b>{{array}}</b></span> <br /> </div> </div> </div></ion-content></ion-view>
Thanks....
No comments:
Post a Comment