
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Set Focus on Text Input in a List with AngularJS and HTML5
To set focus on a text input in a list, try the following code:
newApp.directive('focus', function () { return function (scope, element, attrs) { attrs.$observe('focus', function (newValue) { newValue === 'true' && element[0].focus(); }); } });
The following is the HTML:
<input type="text" ng-model="cues[$index].text" focus="{{cue.isNewest}}" class="input-xlarge" />{{cue.isNewest}}
Advertisements