Skip to content

Instantly share code, notes, and snippets.

@Hawksbillcat
Created October 18, 2018 08:39
Show Gist options
  • Save Hawksbillcat/ffbe0cf95561d72d0fd00380bb7e9fb4 to your computer and use it in GitHub Desktop.
Save Hawksbillcat/ffbe0cf95561d72d0fd00380bb7e9fb4 to your computer and use it in GitHub Desktop.
//第一頁
pair=[];
constructor(public navCtrl: NavController, public navParams: NavParams,public model:ModalController,private storage: Storage,private nativestorage:NativeStorage) {
this.NameOfList=["A19 LED BULB RGBW","Philla Door Lock","In-Wall Fan Control"]
this.pair.length=0;
for(let i=0;i<this.NameOfList.length;i++){
this.pair.push({ outer_name:this.NameOfList[i],
user_device:"",
user_room:"",
group:false,
})
}
}//在建構式裡面先設定好
press(index:number){//換頁 同時傳ARRAY跟INDEX
this.nativestorage.setItem("ppp",this.pair)
this.navCtrl.push(PairRoomPage,{id:index,NameOfList:this.NameOfList})
}
ooo(){//在第一頁下面有個按鈕 在這裡查看(但都沒變)
let mm=this.nativestorage.getItem("ppp").then(mm=>{
console.log(mm)
})
}
/********************************下面是第二頁*******************************/
oop(){//從上一頁面傳來的INDEX+ARRAY
let id=this.navParams.get("id")
let b=this.nativestorage.getItem("ppp").then(data=>{
console.log(data)
console.log(data[id])
data[id].group=true;
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment