Skip to content

Instantly share code, notes, and snippets.

<ion-item>
<ion-select [(ngModel)]="group" [selectOptions]="musicAlertOpts" placeholder="Choose a Category">
<ion-option *ngFor="let group of iris_group" >{{group}}</ion-option>
</ion-select>
</ion-item>
//------------------------------------------------------------------------------------------------------------//
console.log( "group = "+this.group);
console.log( "name "+this.contact_name);
console.log( "relationship = "+this.relationship);
//第一頁
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,
可以大概寫一下嗎?
<ion-list >
<ion-item-sliding *ngFor="let todo of todoList; let i = index;" >
<!-- <button ion-item (click)="detail(i)"> -->
<button ion-item detail-none (click)="detail(i)" >
<span>{{ todo.des }}</span>
<ion-icon name="checkmark" item-end *ngIf="todo.clicked"></ion-icon>
</button>
<ion-item-options>
<button class="red" (click)="delete(i)">
<ion-icon name="trash"></ion-icon>
presentLoadingText() {
let start=2000;
let count=0;
let scanTime;
let deadTimer;
////////////////////////////////////////
let startLoad=()=>{
loadBar();
$scope.ReadWeb_promise = function (url) {//這裡是讀取網頁資料的promise
return new Promise(function(resolve,reject){
var Login = $scope.mobileStore("Login", "", "GET");
var Pwd = $scope.mobileStore("Pwd", "", "GET");
var request = new XMLHttpRequest();
request.open("GET", url, false,Login,Pwd);
request.onreadystatechange = function() {
if (request.readyState == 4) {
if (request.status == 200){
resolve(request.responseText)
$scope.ReadWeb_promise = function (url) {//parse web site for promise
return new Promise(function(resolve,reject){
var Login = $scope.mobileStore("Login", "", "GET");
var Pwd = $scope.mobileStore("Pwd", "", "GET");
var request = new XMLHttpRequest();
request.open("GET", url, false,Login,Pwd);
request.onreadystatechange = function() {
if (request.readyState == 4) {
if (request.status == 200){
resolve(request.responseText)
$scope.get_romig_24g=function(){
$scope.handle().then(function(res){
console.log("$scope.ip[0] "+ $scope.ip[0])
console.log("res "+res)
let url= "http://"+res+"/boafrm/formWlanRedirect?redirect-url=/wladvanced.htm&wlan_id=1"
return url
},function(err){
console.log(err)
err=err+"no ip"
return err
get_data(){
let irislist_copy:Array<any>;
let irislist_recopy:Array<any>=[];
irislist_copy=this.dp.get_array();
irislist_copy.map((currentValue,index)=>{
return new Promise((resolve,reject)=>{
return this.htttp.get("http://"+irislist_copy[index].No_IP+"/cgi-bin/iris.cgi?name=").subscribe(res=>{
irislist_recopy.push({No_IP:irislist_copy[index].No_IP,
title:res["name"]+"Q",
export class HomePage {
oo:boolean=false;
constructor(public navCtrl: NavController,
public navParams: NavParams,
public plt: Platform,
private ref:ChangeDetectorRef,
public dp: DataProvider,
public http: Http,
public htttp:HttpClient,