Skip to content

Instantly share code, notes, and snippets.

@azaharafernandezguizan
Created October 27, 2018 06:53
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 azaharafernandezguizan/f814b3deb31eb0d241d08c2cfa039f32 to your computer and use it in GitHub Desktop.
Save azaharafernandezguizan/f814b3deb31eb0d241d08c2cfa039f32 to your computer and use it in GitHub Desktop.
Example of component file in Aurelia
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