I am trying to use the Jquery Bracket library on my ionic 2 typescript app. However, the library does not has type definitions. So, I tried to use it traditionally. I placed js and CSS file of the library into my src/assets folder and I added necessary tags into my src/index.html file. Lastly, I declare a variable on my typescript file and tried to use it like it's suggested on the examples on the library site.
import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import * as $ from 'jquery'
declare var Options: any;
@Component({
selector: 'page-tournament-schedule',
templateUrl: 'tournament-schedule.html'
})
export class TournamentSchedulePage {
constructor(public navCtrl: NavController) {
}
ionViewDidLoad() {
console.log('Hello TournamentSchedule Page');
this.getBrackets();
}
getBrackets() {
var singleElimination = {
"teams": [ // Matchups
["Team 1", "Team 2"], // First match
["Team 3", "Team 4"] // Second match
],
"results": [ // List of brackets (single elimination, so only one bracket)
[ // List of rounds in bracket
[ // First round in this bracket
[1, 2], // Team 1 vs Team 2
[3, 4] // Team 3 vs Team 4
],
[ // Second (final) round in single elimination bracket
[5, 6], // Match for first place
[7, 8] // Match for 3rd place
]
]
]
}
$('.demo').Options.bracket({
init: singleElimination
});
}
}
But, it's giving me the following error
Cannot read property 'bracket' of undefined