zoukankan      html  css  js  c++  java
  • Angular Local Storage 使用方法

    JS Example
    var YourCtrl = function($scope, localStorageService, ...) {
      // To add to local storage
      localStorageService.set('localStorageKey','Add this!');
      // Read that value back
      var value = localStorageService.get('localStorageKey');
      // To remove a local storage
      localStorageService.remove('localStorageKey');
      // Removes all local storage
      localStorageService.clearAll();
      // You can also play with cookies the same way
      localStorageService.cookie.set('localStorageKey','I am a cookie value now');
    }

    API Access

    CallArgumentsActionReturns
    isSupported n/a Checks the browsers support for local storage Boolean for success
    set key, value Adds a key-value pair to the browser local storage Boolean for success
    get key Gets a value from local storage Stored value
    remove key, ... Removes a key-value pairs from the browser local storage n/a
    clearAll n/a Warning Removes all local storage key-value pairs for this app. It will optionally take a string, which is converted to a regular expression, and then clears keys based on that regular expression. Boolean for success
    cookie set | get | remove | clearAll Each function within cookie uses the same arguments as the coresponding local storage functions n/a
  • 相关阅读:
    hadoop面试
    常用脚本
    1.kafka
    2.flink
    java面试
    Hbase 项目
    linux 2>&1 和 &的意思
    Jetbrains系列产品重置试用方法
    解决GitHub网页githubusercontent地址无法访问问题
    stylus 成熟的写法
  • 原文地址:https://www.cnblogs.com/adjk/p/5756149.html
Copyright © 2011-2022 走看看