changed html autofocus to an angular directive

autofocus is html5y and worked on chrome but not firefox for me.
This commit is contained in:
Henry Oswald 2014-07-24 14:57:53 +01:00
parent b15adefed7
commit 726719ce3f
3 changed files with 13 additions and 2 deletions

View file

@ -20,7 +20,7 @@ block content
placeholder='email@example.com',
ng-model="email",
ng-model-options="{ updateOn: 'blur' }",
autofocus
focus="true"
)
span.small.text-primary(ng-show="loginForm.email.$invalid && loginForm.email.$dirty")
| Must be an email address

View file

@ -32,7 +32,7 @@ block content
ng-model="email",
ng-init="email = #{JSON.stringify(new_email)}",
ng-model-options="{ updateOn: 'blur' }",
autofocus
focus="true"
)
span.small.text-primary(ng-show="registerForm.email.$invalid && registerForm.email.$dirty")
| Must be an email address

View file

@ -55,6 +55,17 @@ define [
selectName(element)
}
App.directive "focus", ($timeout) ->
scope:
trigger: "@focus"
link: (scope, element) ->
scope.$watch "trigger", (value) ->
if value is "true"
$timeout ->
element[0].focus()
selectName = (element) ->
# Select up to last '.'. I.e. everything
# except the file extension