Created
October 27, 2018 06:53
-
-
Save azaharafernandezguizan/f814b3deb31eb0d241d08c2cfa039f32 to your computer and use it in GitHub Desktop.
Example of component file in Aurelia
This file contains 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 { IgNobel } from './models/IgNobel'; | |
import { inject } from 'aurelia-framework'; | |
import { IgNobelService } from './services/IgNobel-service'; | |
@inject(IgNobelService) | |
export class Fun { | |
igNobelService : IgNobelService; | |
igNobelRandomList : IgNobel[]; | |
igNobelTotalData: IgNobel[]; | |
igNobelRandomListLength : number; | |
constructor() { | |
this.igNobelService = new IgNobelService(); | |
this.igNobelRandomListLength = 4; | |
this.getIgNobels(); | |
} | |
getIgNobels() { | |
this.igNobelService.getIgNobels(this, function (objectApp) { | |
objectApp.igNobelTotalData = objectApp.dataList; | |
objectApp.getRandomIgNobel(objectApp.dataList); | |
}); | |
} | |
getRandomIgNobel(igNobelList) { | |
this.igNobelRandomList = this.igNobelService.getRandomIgNobels(igNobelList, this.igNobelRandomListLength); | |
} | |
moreIgNobel(){ | |
this.getRandomIgNobel(this.igNobelTotalData); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment