Use regex en typeScript
var trigger = "2",
regexp = new RegExp('^[1-9]\d{0,2}$'),
test = regexp.test(trigger);
alert(test + ""); // will display true
Helpful Hippopotamus