angularjs focus not working
myApp.directive('focusMe', function () {
return {
link: function(scope, element, attrs) {
scope.$watch(attrs.focusMe, function(value) {
if(value === true) {
element[0].focus();
element[0].select();
}
});
}
};
});
<input type="text" ng-model="stuff.name" focus-me="true" />