Topic: Foreach error with mdb-auto-completer
itay pro asked 5 years ago
I am getting a lot of errors of: TypeError: Object doesn't support property or method 'forEach'
Although I don't seem to find exactly the source, nor reproduce it, it does looks as if it originates from within the implementation of mdb-auto-completer, perhaps with option list is empty
Here is a snippet of production code: n.prototype.show=function(){this._isOpen=!0},n.prototype.hide=function(){this._isOpen=!1},n.prototype.removeHighlight=function(n){var e=this;setTimeout(function(){e.optionList.forEach(function(t,l){var i=t.nativeElement.querySelectorAll(".completer-row");l===n?e.renderer.addClass(t.nativeElement.firstElementChild,"highlight-row"):l!==n&&i.forEach(function(n){e.renderer.removeClass(n,"highlight-row")})})},0)},n.prototype.highlightRow=function(n){var e=this;this._allItems=this.optionList.filter(function(n){return n.nativeElement.firstElementChild.classList.contains("completer-row")}).map(function(n){return n.nativeElement}),this._allItems[n]&&this.optionList.forEach(function(t,l){var i=t.nativeElement.querySelectorAll(".completer-row");n===l&&(e.removeHighlight(n),e.renderer.addClass(i[i.length-1],"highlight-row"))}),this._selectedItemIndex=n}
The source is the foreach in here: ... (t.nativeElement.firstElementChild,"highlight-row"):l!==n&&i.forEach(function(n){e.renderer.removeClass(n,"highlight-row")})})},0)},n.protot ...
Are you familiar with this and can guide me to a solution ?
Damian Gemza staff answered 5 years ago
Yes, I recognize the code which you have provided me. But still, I don't know how to reproduce this problem. Without this information, I won't be able to help you with your problem.
itay pro answered 5 years ago
Do you recognize the code snippet ?
This is the information I get from the users: User-Agent = Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko Some use chrome, some edge
Damian Gemza staff answered 5 years ago
Dear mdb2,
We didn't discover any errors while using or building the MDB Pro library.
Without guideline how to reproduce this problem I won't be able to help you, because, on my side, there are no errors in the whole MDB Angular library. Especially with .forEach() method.
On which browser you're getting those errors? Also provide me the full environment informations - OS, Device, Angular version, Node version.
Best Regards,
Damian
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- ForumUser: Pro
- Premium support: No
- Technology: MDB Angular
- MDB Version: 7.4.0
- Device: NA
- Browser: NA
- OS: NA
- Provided sample code: No
- Provided link: No