Check out this plunker - http://plnkr.co/edit/PaG1k5N37BTOflObnN7K?p=preview
Situation 1:
Step 1 - If you type "m" in the tags
input field, a suggestion of Marie
will pop up.
Step 2 - Typing "j" will bring up John
as a suggestion.
Step 3 - Retyping "m" will not show any suggestions. The functionality is implemented in script.js
where Marie
is removed from $scope.to
because it was already added to the tags
input box in step 1.
Situation 2:
Step 1 - Entering "m" in the tags
input box displays Marie
as a suggestion.
Step 2 - Re-entering "m" still shows Marie
as a suggestion.
This means that until John
or Ghita
are entered in the tags
input box, Marie
remains as a suggestion. Once John
is entered, Marie
stops appearing as a suggestion.
Do you have any insight on why this behavior occurs?
I attempted using $scope.$apply()
, but I encountered an error stating that a $digest
cycle is already in progress. So, if $scope.$digest()
is currently running, why isn't the $scope.to
variable being updated?