• angular 搜索记录保留


     1   #方法1:   点击后退到home后,再点击搜索, locationChangeStart 事件会多次触发。
     2   # $scope.keyword =  $location.search().search
     3   # $scope.search = ()->
     4   #   return if $scope.isSearching
     5   #   return unless $scope.sitetype and $scope.keyword
     6   #   $location.search({search: $scope.keyword})
     7 
     8   #   if $scope.sitetype == 'site'
     9   #     $scope.doSearch()
    10   #   else
    11   #     $scope.connectSocket($scope.doSearch)
    12 
    13   # #有关键词的时候,执行搜索任务
    14   # if $scope.keyword
    15   #   $scope.search()
    16 
    17   # $rootScope.$on '$locationChangeStart', (e, next, current)->
    18   #   console.log 'locationChangeStart...'
    19   #   $scope.keyword =  $location.search().search
    20   #   $scope.search()
    21 
    # 方法2 路由: url: '/search/*path' 22 $scope.keyword = $location.path().slice(8) 23 $scope.setPath = (keyword)-> 24 if !keyword 25 keyword = $scope.keyword 26 $location.path('/search/'+keyword)
       #搜索
        if $scope.keyword
           $scope.search()
  • 相关阅读:
    .net 使用 swagger 操作
    oracle 基础
    关于webapi跨域问题的一些坑坑
    sqlHelper
    微博数据接入开发
    mvc后台上传
    sql server 报错处理
    asp.net 微信开发(二)
    收集一些关于OI/ACM的奇怪的东西……
    LeetCode 229 Majority Element II
  • 原文地址:https://www.cnblogs.com/wanqiu/p/4788367.html
Copyright © 2020-2023  润新知