mirror of https://github.com/moparisthebest/mail
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', []);
|
var ngModule = angular.module('mail-list', []);
|
||||||
ngModule.directive('ngIscroll', function() {
|
ngModule.directive('ngIscroll', function($timeout) {
|
||||||
return {
|
return {
|
||||||
link: function(scope, elm) {
|
link: function(scope, elm) {
|
||||||
setTimeout(function() {
|
$timeout(function() {
|
||||||
var myScroll;
|
var myScroll;
|
||||||
// activate iscroll
|
// activate iscroll
|
||||||
myScroll = new IScroll(elm[0], {
|
myScroll = new IScroll(elm[0], {
|
||||||
mouseWheel: true
|
mouseWheel: true
|
||||||
});
|
});
|
||||||
}, 0);
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -167,11 +167,21 @@ define(function(require) {
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
ngModule.directive('focusMe', function($timeout) {
|
ngModule.directive('focusMe', function($timeout, $parse) {
|
||||||
return {
|
return {
|
||||||
link: function(scope, element) {
|
//scope: true, // optionally create a child scope
|
||||||
$timeout(function() {
|
link: function(scope, element, attrs) {
|
||||||
element[0].focus();
|
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">
|
<div class="headers">
|
||||||
<p>
|
<p>
|
||||||
<span>To:</span>
|
<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>
|
||||||
<p>
|
<p>
|
||||||
<span>Cc:</span>
|
<span>Cc:</span>
|
||||||
|
|
Loading…
Reference in New Issue