Guest User

Untitled

a guest
Oct 18th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. //第一頁
  2. pair=[];
  3. constructor(public navCtrl: NavController, public navParams: NavParams,public model:ModalController,private storage: Storage,private nativestorage:NativeStorage) {
  4. this.NameOfList=["A19 LED BULB RGBW","Philla Door Lock","In-Wall Fan Control"]
  5. this.pair.length=0;
  6. for(let i=0;i<this.NameOfList.length;i++){
  7. this.pair.push({ outer_name:this.NameOfList[i],
  8. user_device:"",
  9. user_room:"",
  10. group:false,
  11. })
  12.  
  13. }
  14. }//在建構式裡面先設定好
  15.  
  16. press(index:number){//換頁 同時傳ARRAY跟INDEX
  17. this.nativestorage.setItem("ppp",this.pair)
  18. this.navCtrl.push(PairRoomPage,{id:index,NameOfList:this.NameOfList})
  19. }
  20. ooo(){//在第一頁下面有個按鈕 在這裡查看(但都沒變)
  21. let mm=this.nativestorage.getItem("ppp").then(mm=>{
  22. console.log(mm)
  23. })
  24. }
  25. /********************************下面是第二頁*******************************/
  26.  
  27. oop(){//從上一頁面傳來的INDEX+ARRAY
  28. let id=this.navParams.get("id")
  29. let b=this.nativestorage.getItem("ppp").then(data=>{
  30. console.log(data)
  31. console.log(data[id])
  32. data[id].group=true;
  33. })
  34. }
Add Comment
Please, Sign In to add comment