angular 搜索记录保留

   #方法1:   点击后退到home后,再点击搜索, locationChangeStart 事件会多次触发。
# $scope.keyword = $location.search().search
# $scope.search = ()->
# return if $scope.isSearching
# return unless $scope.sitetype and $scope.keyword
# $location.search({search: $scope.keyword}) # if $scope.sitetype == 'site'
# $scope.doSearch()
# else
# $scope.connectSocket($scope.doSearch) # #有关键词的时候,执行搜索任务
# if $scope.keyword
# $scope.search() # $rootScope.$on '$locationChangeStart', (e, next, current)->
# console.log 'locationChangeStart...'
# $scope.keyword = $location.search().search
# $scope.search()

# 方法2 路由: url: '/search/*path'
$scope.keyword = $location.path().slice(8)
$scope.setPath = (keyword)->
if !keyword
keyword = $scope.keyword
$location.path('/search/'+keyword)
   #搜索
    if $scope.keyword
       $scope.search()
上一篇:Xen虚拟化基本原理详解


下一篇:configs for postgresql restart and postgresql reload