本文整理汇总了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)
}
})
}
示例2: getTable
getTable(tableName: string): Promise<string> {
return this.storage.get(tableName.toLowerCase())
.catch( (reason) => {
console.log('EntityManager.prototype.getTable():')
console.dir(reason.err);
});
}
示例3: constructor
constructor() {
this.storage = new Storage(SqlStorage, { name: SettingsService.DBNAME });
this.storage.get(SettingsService.DBKEY).then(
data => this.settings = JSON.parse(data||"{}")
);
}
示例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");
}
);
}
示例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});
}
});
*/
});
}
示例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;
})
};
示例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();
}
});
示例8: constructor
constructor() {
this.storage = new Storage(SqlStorage, { name: 'todos' });
this.storage.get('todos').then(
todos => this.data = JSON.parse(todos||"[]")
);
}
示例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
});
});
}
示例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
});
});
}