quickly filling in a typeahead box gets Cannot read property 'selectMode' of null
if type in everything slowly, it works fine. ng-options="ymm.Detail as ymm.Detail for ymm in getVehicles($viewValue)"
TypeError: Cannot read property 'selectMode' of null at https://mgcrea.github.io/angular-strap/dist/angular-strap.js:4293:23 at wrappedCallback (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.25/angular.js:11572:81) at https://ajax.googleapis.com/ajax/libs/angularjs/1.2.25/angular.js:11658:26 at Scope.$eval (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.25/angular.js:12701:28) at Scope.$digest (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.25/angular.js:12513:31) at https://ajax.googleapis.com/ajax/libs/angularjs/1.2.25/angular.js:12739:26 at completeOutstandingRequest (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.25/angular.js:4397:10) at https://ajax.googleapis.com/ajax/libs/angularjs/1.2.25/angular.js:4705:7
Can you provide a sample reproducing your issue please?
I'm getting the same, was this ever solved? TypeError: Cannot read property 'selectMode' of null at typeahead.js:259 at angular.js:13171 at l.$get.l.$eval (angular.js:14384) at l.$get.l.$digest (angular.js:14200) at l.$get.l.$apply (angular.js:14489) at l (angular.js:9646) at O (angular.js:9836) at XMLHttpRequest.w.onload (angular.js:9777)
Getting the same issue.
same issue
can you change :
options.selectMode
to
options && options.selectMode
that will break the logic operator if null before it gets to options.selectMode
@Hrafnkellos, not quite sure where you're making this edit. I tried a few places and it doesn't correct the issue.
Did you find a better solution?
@Josh1289op Have you found a solution? I'm having this issue as well.
As you can see in the stack trace the error is coming from a digest triggered by an xhr request completing. In my case after selecting an optiion the xhr was triggering to load items matching the text of what I selected (IMO it should not trigger a search after selecting item, seems pointless). I was redirecting ($location.path) in response to the selection and i would guess the xhr was completing after the typeahead directive had been destroyed.. maybe?
I think the fix is to simply not search after selecting - how is that useful?
PS. I stopped the error by setting a flag in the select event handler that stopped the search method from actually doing anything.
var preventSearch = false;
$scope.search = function (query) {
if (preventSearch) {
return;
}
....
}
$scope.$on('$typeahead.select', function (event, value) {
preventSearch = true;
$location.path('...')
});
+1 this is still causing us issues as well.
+1 same issue.
This has been open for over two years, is this going to be addressed?
We need a reproducible error for this. @robpolak have you tried to fix the bug?
Guys, I believe Hrafnkellos solution solved this for me.
Feel free to PR, @rexthepenguin, if you can get a test in-place too
Sorry, it's been so long since I used it, I don't know where my code is, but I remember I search strap source for options.selectMode
and just changed it to:
options && options.selectMode
which makes sense as it checks that options isn't Null before it tries a method on it. Hope this helps
On 13 Nov 2016 22:07, "Dale Alexander Webb" [email protected] wrote:
Feel free to PR, @rexthepenguin https://github.com/rexthepenguin, if you can get a test in-place too
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mgcrea/angular-strap/issues/1124#issuecomment-260216516, or mute the thread https://github.com/notifications/unsubscribe-auth/AEEk_QikWU-iQd9NNAs4KLqfzHVzd-dqks5q94ougaJpZM4Cqhv0 .
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.