mirror of
https://github.com/moparisthebest/mail
synced 2025-02-07 10:30:18 -05:00
try to fix focus
This commit is contained in:
parent
f3b4140f81
commit
88f3fe567c
@ -214,16 +214,16 @@ define(function(require) {
|
||||
//
|
||||
|
||||
var ngModule = angular.module('mail-list', []);
|
||||
ngModule.directive('ngIscroll', function() {
|
||||
ngModule.directive('ngIscroll', function($timeout) {
|
||||
return {
|
||||
link: function(scope, elm) {
|
||||
setTimeout(function() {
|
||||
$timeout(function() {
|
||||
var myScroll;
|
||||
// activate iscroll
|
||||
myScroll = new IScroll(elm[0], {
|
||||
mouseWheel: true
|
||||
});
|
||||
}, 0);
|
||||
});
|
||||
|
||||
}
|
||||
};
|
||||
|
@ -167,11 +167,21 @@ define(function(require) {
|
||||
};
|
||||
});
|
||||
|
||||
ngModule.directive('focusMe', function($timeout) {
|
||||
ngModule.directive('focusMe', function($timeout, $parse) {
|
||||
return {
|
||||
link: function(scope, element) {
|
||||
$timeout(function() {
|
||||
element[0].focus();
|
||||
//scope: true, // optionally create a child scope
|
||||
link: function(scope, element, attrs) {
|
||||
var model = $parse(attrs.focusMe);
|
||||
scope.$watch(model, function(value) {
|
||||
if (value === true) {
|
||||
$timeout(function() {
|
||||
element[0].focus();
|
||||
});
|
||||
}
|
||||
});
|
||||
// set attribute value to 'false' on blur event:
|
||||
element.bind('blur', function() {
|
||||
scope.$apply(model.assign(scope, false));
|
||||
});
|
||||
}
|
||||
};
|
||||
|
@ -9,7 +9,7 @@
|
||||
<div class="headers">
|
||||
<p>
|
||||
<span>To:</span>
|
||||
<input type="email" ng-model="to" class="address-input" tabindex="1" focus-me>
|
||||
<input type="email" ng-model="to" class="address-input" tabindex="1" focus-me="writerOpen">
|
||||
</p>
|
||||
<p>
|
||||
<span>Cc:</span>
|
||||
|
Loading…
Reference in New Issue
Block a user