day one build
This commit is contained in:
79
src/app/game-grid/game-grid.component.ts
Normal file
79
src/app/game-grid/game-grid.component.ts
Normal file
@@ -0,0 +1,79 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
|
||||
import { GamesService } from '../games.service';
|
||||
|
||||
declare var jquery:any;
|
||||
declare var $ :any;
|
||||
|
||||
declare var masonry:any;
|
||||
|
||||
@Component({
|
||||
selector: 'app-game-grid',
|
||||
templateUrl: './game-grid.component.html',
|
||||
styleUrls: ['./game-grid.component.css']
|
||||
})
|
||||
export class GameGridComponent implements OnInit {
|
||||
|
||||
gameListSubscription;
|
||||
rawGamesContent;
|
||||
gamesData;
|
||||
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private gamesService: GamesService
|
||||
){
|
||||
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
this.getGamesList();
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
getGamesList(): any{
|
||||
this.gameListSubscription = this.gamesService.getGames( ).subscribe( data => {
|
||||
console.log( data );
|
||||
this.gamesData = data.games;
|
||||
//var tempItemContent = [];
|
||||
|
||||
/* parse out just the input data and set that in object array */
|
||||
/*for( var key in data['ContentBlocks'] ){
|
||||
console.log( data['ContentBlocks'][key]['Type'] );
|
||||
if( data['ContentBlocks'][key]['Type'] == "ItemSelectionSetting" ){
|
||||
tempItemContent.push( data['ContentBlocks'][key]['Content'] );
|
||||
}
|
||||
}
|
||||
this.formItemContent = tempItemContent;
|
||||
*/
|
||||
});
|
||||
}
|
||||
|
||||
isEmptyObject(obj) {
|
||||
return (obj != undefined);
|
||||
}
|
||||
|
||||
isNotEmptyObject(obj) {
|
||||
return (obj == undefined);
|
||||
}
|
||||
|
||||
renderGridItems(lastItem: boolean) {
|
||||
if (lastItem) {
|
||||
$('.grid').masonry({
|
||||
columnWidth: '.grid-sizer',
|
||||
itemSelector: '.grid-item',
|
||||
percentPosition: true
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user