Created
April 5, 2018 04:05
-
-
Save jcuervo/86f38cd533164d2aae78fced5f7fcef8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable } from '@angular/core'; | |
@Injectable() | |
export class AppSettingsProvider { | |
endPoint: string; | |
baseUrl: string; | |
mode: string; | |
constructor() { | |
let domain = "http://192.168.1.4:3000/"; | |
// let domain = "http://2a2cb1ba.ngrok.io/"; | |
// this.mode = 'browser'; // mobile if on mobile mode | |
this.mode = 'mobile'; | |
this.endPoint = domain; | |
this.baseUrl = domain; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Http } from "@angular/http"; | |
import { Injectable } from '@angular/core'; | |
import { AppSettingsProvider } from '../app-settings/app-settings'; | |
@Injectable() | |
export class ControlsProvider { | |
constructor( | |
public http: Http, | |
public appSettings: AppSettingsProvider | |
) {} | |
getDeviceList() { | |
let url = this.appSettings.endPoint + "devices.json"; | |
return new Promise((resolve, reject) => { | |
this.http.get(url).subscribe( | |
res => { | |
resolve(res.json()); | |
}, | |
err => { | |
reject(err); | |
} | |
); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment