Permalink
Browse files

feat(modal): support input[autofocus] (fixes #80)

  • Loading branch information...
1 parent 646956c commit 00a084e3f2be2536c0389419b2137d8deb5ab137 @mgcrea committed Mar 30, 2013
Showing with 10 additions and 12 deletions.
  1. +10 −12 src/directives/modal.js
View
22 src/directives/modal.js
@@ -39,7 +39,7 @@ angular.module('$strap.directives')
});
// Provide scope display functions
- scope._modal = function(name) {
+ scope.$modal = function(name) {
$modal.modal(name);
};
scope.hide = function() {
@@ -50,20 +50,18 @@ angular.module('$strap.directives')
};
scope.dismiss = scope.hide;
- $modal.on("show", function(event) {
- scope.$emit("modal-show", event);
+ $modal.on('show', function(event) {
+ scope.$emit('modal-show', event);
});
-
- $modal.on("shown", function(event) {
- scope.$emit("modal-shown", event);
+ $modal.on('shown', function(event) {
+ scope.$emit('modal-shown', event);
+ $('input[autofocus]').first().trigger('focus');
});
-
- $modal.on("hide", function(event) {
- scope.$emit("modal-hide", event);
+ $modal.on('hide', function(event) {
+ scope.$emit('modal-hide', event);
});
-
- $modal.on("hidden", function(event) {
- scope.$emit("modal-hidden", event);
+ $modal.on('hidden', function(event) {
+ scope.$emit('modal-hidden', event);
});
});

0 comments on commit 00a084e

Please sign in to comment.