Hi Ankur,
In such a case, use a direcive like this:
.directive('myFocus', function () {
var ddo = {
restrict : 'A', // only antribute
link : function (scope, element, attrs) {
scope.$watch(attrs.myFocus, function (newVal) {
if (!!newVal) {
element[0].focus();
// you might want to reset the myFocus here, so it works
more then once.
}
});
}
};
return ddo;
};
Does that help?
Regards
Sander
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.