當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript Storage.get方法代碼示例

本文整理匯總了TypeScript中ionic-angular.Storage.get方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Storage.get方法的具體用法?TypeScript Storage.get怎麽用?TypeScript Storage.get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ionic-angular.Storage的用法示例。


在下文中一共展示了Storage.get方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: constructor

 username:any;//用戶是否登錄
 constructor(
     private nav: NavController
     //private imagePicker:ImagePicker
 ) {
   this.user = {
     name:'',
     password:'',
     headface:'images/4.jpg'
   };
   this.local = new Storage(LocalStorage);
   //localStorage取值問題
   this.local.get('username').then( (res) =>{
   
       if( res ){
         this.user.headface = "images/" + res + ".jpg";
       }else{
         let modal = Modal.create(Login)
         modal.onDismiss(data => {
           console.log(data)
           this.user.headface = "images/" + data + ".jpg";
         })
         this.nav.present(modal)
       }
   })
 }
開發者ID:zhangxianmeng,項目名稱:ionicDemo,代碼行數:26,代碼來源:userCenter.ts

示例2: getTable

 getTable(tableName: string): Promise<string> {
   return this.storage.get(tableName.toLowerCase())
     .catch( (reason) => {
       console.log('EntityManager.prototype.getTable():')
       console.dir(reason.err);
     });
 }
開發者ID:scunningham777,項目名稱:Fantazaar,代碼行數:7,代碼來源:entity-manager.ts

示例3: constructor

  constructor() {
    this.storage = new Storage(SqlStorage, { name: SettingsService.DBNAME });

    this.storage.get(SettingsService.DBKEY).then(
      data => this.settings = JSON.parse(data||"{}")
    );
  }
開發者ID:clervens,項目名稱:IonicTodoApp,代碼行數:7,代碼來源:settings-service.ts

示例4: initApp

  initApp() {

      this.locationService.refreshCurrentLocation();

      this.events.subscribe("loginSuccess", () => {
        this.rootPage = TabsPage;
      });

      // Check if existing user
      this.db.get("account").then(data => {
        if (data !== undefined) {

          //TODO Implement offline mode if there is no network connection
          this.accountService.tokenLogin(JSON.parse(data));

        } else {
          // Display intro page for new users w/c allows them to register/login
          this.rootPage = IntroPage;
        }
      },
        error => {
          console.log("DB Failure");
        }
      );
  }
開發者ID:eabquina,項目名稱:blottr,代碼行數:25,代碼來源:app.ts

示例5: setupAuth

  private setupAuth() {
    //the af auth subscribe is slow to retrieve the key from local storage

    return this.storage.get('user_auth').then((user_data_string)=> {

      //debug until login is fixed

      this.InitUser({
        "uid": "HXACL4BGMoRx5MitbOl5v3FBSIC3",
        "displayName": "Ricky Rivera",
        photoURL: "https://lh3.googleusercontent.com/-Y08mWF2-A2M/AAAAAAAAAAI/AAAAAAAAH_o/RLFgPBcXft8/s96-c/photo.jpg"
      });
      this.HasUserRegistered = true;

      /*
       if (user_data_string) {
       try {
       let user_data = JSON.parse(user_data_string);
       this.InitUser(user_data);
       }
       catch (err) {
       }
       }

      //listen for login changes
      this.af.auth.subscribe((authState) => {
        if (authState && !this.loggedIn) {
          let auth = authState.auth;
          this.InitUser(auth);
          this.setUserAuthInStorage({uid: auth.uid, displayName: auth.displayName, photoURL: auth.photoURL});
        }
      });
      */
    });
  }
開發者ID:RickyTaterSalad,項目名稱:FireIonic2,代碼行數:35,代碼來源:user-data.ts

示例6: load

    load() {
        this.local.get('user').then((value) => {
            if (value == null)
                this.username = ""
            else
                this.username = value
        })

        this.local.get('pass').then((value) => {
            if (value == null)
                this.password = ""
            else
                this.password = value;
        })

    };
開發者ID:idontgotit,項目名稱:test,代碼行數:16,代碼來源:home.ts

示例7: function

    global.socket.on('api-member-login', function (data) {
      if (data.success) { // ถ้าเข้าระบบสำเร็จ
        storage.set('token', data.token);
        storage.get('page').then((page) => {
          if (page == 'signOut' || page == 'signIn') {
            storage.set('page', 'shopping');
            global.socket.emit('api', {
              token: data.token,
              module: 'system',
              action: 'screen'
            });

            global.socket.emit('api', {
              token: data.token,
              module: 'member',
              action: 'profile'
            });
          }
        });
      }
      else { // ถ้ามี Error
        let alert = alertCtrl.create({
          title: global.message.error,
          subTitle: global.message['err' + data.error],
          buttons: [global.message.ok]
        });
        alert.present();
      }
    });
開發者ID:RemaxThailand,項目名稱:RemaxMobile,代碼行數:29,代碼來源:app.ts

示例8: constructor

  constructor() {
    this.storage = new Storage(SqlStorage, { name: 'todos' });

    this.storage.get('todos').then(
      todos => this.data = JSON.parse(todos||"[]")
    );
  }
開發者ID:clervens,項目名稱:IonicTodoApp,代碼行數:7,代碼來源:todos-service.ts

示例9: constructor

  constructor(private navCtrl: NavController, private navParams: NavParams, private loadingCtrl: LoadingController) {
    this.global = this.navParams.get('global');
    this.orderNo = this.navParams.get('orderNo');
    
    this.global.isLoaded = false;
    let loader = this.loadingCtrl.create({
      content: "Please wait...",
    });
    loader.present();

    var timer = setInterval(() => {
      if(this.global.isLoaded) {
        clearInterval(timer);
        loader.dismiss();
      }
    }, 500);

    /*## รายละเอียดการชำระเงิน ##*/
    let storage = new Storage(LocalStorage);
    storage.get('token').then((token) => {
      this.global.socket.emit('api', {
        token: token,
        module: 'order',
        action: 'payment_data',
        orderNo: this.orderNo
      });
    });
  }
開發者ID:RemaxThailand,項目名稱:RemaxMobile,代碼行數:28,代碼來源:payments-detail.ts

示例10: constructor

  constructor(private navCtrl: NavController, private navParams: NavParams, private loadingCtrl: LoadingController) {
    this.global = this.navParams.get('global');
    this.type = this.navParams.get('type');
    this.code = this.navParams.get('code');

    this.global.subData = {};

    this.global.isLoaded = false;
    let loader = this.loadingCtrl.create({
      content: this.global.message.pleaseWait+"...",
    });
    loader.present();

    var timer = setInterval(() => {
      if(this.global.isLoaded) {
        clearInterval(timer);
        loader.dismiss();
      }
    }, 500);

    let storage = new Storage(LocalStorage);
    storage.get('token').then((token) => {
      this.global.socket.emit('api', {
        token: token,
        module: 'curl',
        action: 'shipping',
        type: this.type,
        code: this.code,
        langCode: this.global.langCode
      });
    });
  }
開發者ID:RemaxThailand,項目名稱:RemaxMobile,代碼行數:32,代碼來源:shipping-tracking.ts


注:本文中的ionic-angular.Storage.get方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。