BF: tab completion did not work with commands. $scope.input contained only the typed chars not the result of the completion.
Needed to fire an event so that ng update the input modelpull/10/head
parent
8a7f7f5004
commit
b3be06667d
|
@ -48,6 +48,9 @@ angular.module('RoomController')
|
||||||
var search = /@?([a-zA-Z0-9_\-:\.]+)$/.exec(text);
|
var search = /@?([a-zA-Z0-9_\-:\.]+)$/.exec(text);
|
||||||
if (targetIndex === 0) {
|
if (targetIndex === 0) {
|
||||||
element[0].value = text;
|
element[0].value = text;
|
||||||
|
|
||||||
|
// Force angular to wake up and update the input ng-model by firing up input event
|
||||||
|
angular.element(element[0]).triggerHandler('input');
|
||||||
}
|
}
|
||||||
else if (search && search[1]) {
|
else if (search && search[1]) {
|
||||||
// console.log("search found: " + search);
|
// console.log("search found: " + search);
|
||||||
|
@ -81,7 +84,10 @@ angular.module('RoomController')
|
||||||
expansion += " ";
|
expansion += " ";
|
||||||
element[0].value = text.replace(/@?([a-zA-Z0-9_\-:\.]+)$/, expansion);
|
element[0].value = text.replace(/@?([a-zA-Z0-9_\-:\.]+)$/, expansion);
|
||||||
// cancel blink
|
// cancel blink
|
||||||
element[0].className = "";
|
element[0].className = "";
|
||||||
|
|
||||||
|
// Force angular to wake up and update the input ng-model by firing up input event
|
||||||
|
angular.element(element[0]).triggerHandler('input');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// console.log("wrapped!");
|
// console.log("wrapped!");
|
||||||
|
@ -91,6 +97,9 @@ angular.module('RoomController')
|
||||||
}, 150);
|
}, 150);
|
||||||
element[0].value = text;
|
element[0].value = text;
|
||||||
scope.tabCompleteIndex = 0;
|
scope.tabCompleteIndex = 0;
|
||||||
|
|
||||||
|
// Force angular to wake up and update the input ng-model by firing up input event
|
||||||
|
angular.element(element[0]).triggerHandler('input');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Reference in New Issue