Skip to content

Instantly share code, notes, and snippets.

@lx4r

lx4r/details.ts Secret

Created April 27, 2016 19:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lx4r/4f3cc40ffafd30848cecc512c61776e0 to your computer and use it in GitHub Desktop.
Save lx4r/4f3cc40ffafd30848cecc512c61776e0 to your computer and use it in GitHub Desktop.
import {Page,NavController, NavParams} from 'ionic-angular';
import {OnInit} from 'angular2/core';
import {GameService} from "../../../services/game-service";
import {SettingsService} from "../../../services/settings-service";
import {Game} from "../../../interfaces/game";
import {GameDetails} from "../../../interfaces/game-details";
import {Response} from 'angular2/http';
import {BarcodeScanner} from 'ionic-native';
@Page({
templateUrl: 'build/pages/details/details.html',
providers: [GameService, SettingsService]
})
export class DetailsPage implements OnInit{
game: Game;
gameDetails: GameDetails;
constructor (private _gameservice: GameService, private _settingsservice: SettingsService, private _nav: NavController, private _navParams: NavParams){
this.game = _navParams.get('game');
this.gameDetails = {
gameName: "Loading",
gamePrice: 0
}
}
ngOnInit(){
this._gameservice.getDetails(this.game).then(
data => {
console.log("ngOnInit in details.ts started");
this.gameDetails = (<Response>data).json();
console.log(this.gameDetails);
}
);
}
test(){
console.log("Test fired");
BarcodeScanner.scan().then((barcodeData) => {
console.log(barcodeData);
}, (err) => {
console.error(err);
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment