focus vault search on `$viewContentLoaded`

This commit is contained in:
Kyle Spearrin 2017-12-19 11:30:52 -05:00
parent 16892239fb
commit 01ffc68fc2
3 changed files with 4 additions and 2 deletions

View File

@ -47,11 +47,11 @@
$q.all([collectionPromise, cipherPromise]).then(function () { $q.all([collectionPromise, cipherPromise]).then(function () {
$scope.loading = false; $scope.loading = false;
$("#search").focus();
if ($state.params.search) { if ($state.params.search) {
$uibModalStack.dismissAll(); $uibModalStack.dismissAll();
$scope.$emit('setSearchVaultText', $state.params.search); $scope.$emit('setSearchVaultText', $state.params.search);
$('#search').focus();
} }
if ($state.params.viewEvents) { if ($state.params.viewEvents) {

View File

@ -18,6 +18,8 @@
} }
$scope.$on('$viewContentLoaded', function () { $scope.$on('$viewContentLoaded', function () {
$("#search").focus();
if ($rootScope.vaultGroupings && $rootScope.vaultCiphers) { if ($rootScope.vaultGroupings && $rootScope.vaultCiphers) {
$scope.loading = false; $scope.loading = false;
loadGroupingData($rootScope.vaultGroupings); loadGroupingData($rootScope.vaultGroupings);

View File

@ -36,7 +36,7 @@
<label for="search" class="sr-only">Search</label> <label for="search" class="sr-only">Search</label>
<div class="form-group has-feedback"> <div class="form-group has-feedback">
<input type="text" id="search" class="form-control" placeholder="Search my vault..." <input type="text" id="search" class="form-control" placeholder="Search my vault..."
ng-focus="searchVault()" ng-model="main.searchVaultText" autofocus /> ng-focus="searchVault()" ng-model="main.searchVaultText" />
<span class="fa fa-search form-control-feedback" aria-hidden="true"></span> <span class="fa fa-search form-control-feedback" aria-hidden="true"></span>
</div> </div>
</form> </form>