search by height of block

This commit is contained in:
Gustavo Cortez 2014-01-21 10:55:35 -03:00
parent 56dc130b4f
commit ef109e3251
1 changed files with 27 additions and 21 deletions

View File

@ -1,7 +1,7 @@
'use strict';
angular.module('insight.search').controller('SearchController',
function ($scope, $routeParams, $location, $timeout, Global, Block, Transaction, Address) {
function ($scope, $routeParams, $location, $timeout, Global, Block, Transaction, Address, BlockByHeight) {
$scope.global = Global;
$scope.search = function() {
@ -10,6 +10,11 @@ angular.module('insight.search').controller('SearchController',
$scope.badQuery = false;
$scope.q = '';
BlockByHeight.get({
blockHeight: q
}, function(hash) {
$location.path('/block/' + hash.blockHash);
}, function() { // block by height not found
Block.get({
blockHash: q
}, function() {
@ -33,6 +38,7 @@ angular.module('insight.search').controller('SearchController',
});
});
});
});
};
});