forked from Archives/Athou_commafeed
focus feed url input when modal opens
This commit is contained in:
@@ -1,5 +1,21 @@
|
||||
var module = angular.module('commafeed.directives', []);
|
||||
|
||||
module.directive('focus', [ '$timeout', function($timeout) {
|
||||
return {
|
||||
restrict : 'A',
|
||||
link : function(scope, element, attrs) {
|
||||
scope.$watch(attrs.focus, function(value) {
|
||||
if (!value)
|
||||
return;
|
||||
$timeout(function() {
|
||||
$(element).focus();
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
} ]);
|
||||
|
||||
|
||||
/**
|
||||
* Open a popup window pointing to the url in the href attribute
|
||||
*/
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<label class="control-label">${subscribe.feed_url}</label>
|
||||
<div class="controls">
|
||||
<input type="text" name="url" ng-model="sub.url" ng-blur="urlChanged()" placeholder="http://example.com/feed"
|
||||
class="input-block-level" required ng-disabled="state=='loading'"></input>
|
||||
class="input-block-level" required ng-disabled="state=='loading'" focus="isOpen"></input>
|
||||
<span class="help-block" ng-show="!subscribeForm.url.$valid">${global.required}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user