• $anchorScroll和$cache


    1.$achorScroll服务---用于描点跳转

    $scope.change = function(id){

      $location.hash(id);
      $anchorScroll();

    };

    只要给locatioin设置了对应的hash值,就可以直接跳转,但是还是手动执行一下$anchorScroll来避免一些特殊情况

    2.$cache服务---用于缓存数据

    var cache = $cacheFactory('myCache',{capacity : 2});

    cache.put('name','hello');
    cache.put('age','20');
    cache.put('job','it');
    console.log(cache.info());
    cache.get('name');
    cache.remove('name');

    首先通过$cacheFactory('',{})创建cache,其中第一个参数为该cache的id,第二个为配置选项,例如capacity就是配置该cache的最大size为2

    然后就可以通过put和get来设置和获取缓存

  • 相关阅读:
    Socket通信
    浏览器调用打印机
    python dict操作
    python list操作
    python 模块Example链接
    python random模块
    python configparser模块
    python unittest模块
    python timeit模块
    python datetime模块
  • 原文地址:https://www.cnblogs.com/toodeep/p/4984842.html
Copyright © 2020-2023  润新知