Progress: Cannot read property '0' of undefined
See original GitHub issueHello, in my Angular web app I have upgraded Semantic-UI from version 2.4.2 to Fomantic-UI 2.7.4.
Now, when I use progress module with something like this:
$(this._progress.nativeElement).progress('get percent')
I get the following error:
ERROR TypeError: Cannot read property '0' of undefined
at HTMLDivElement.percent (semantic.min.js:11)
at Object.invoke (semantic.min.js:11)
at HTMLDivElement.<anonymous> (semantic.min.js:11)
...
In other cases if I use progress like this:
<div class="ui tiny green progress">
<div class="bar" [style.width]="file.percent + '%'"></div>
</div>
I have no errors in console, but the progress bar doesn’t start or get filled like before upgrade.
For the first case I solved changing Fomantic-UI progress.js source file in the following way:
percent: function(index) {
return module.percent ? module.percent[index || 0] || 0 : 0;
},
value: function(index) {
return module.nextValue || module.value ? module.value[index || 0] || 0 : 0;
}
But this doesn’t do the trick for the second case as well.
What could I fix this?
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
Get this error: Cannot read property '0' of undefined
It works now but I get an error whenever I edit a repair and the server tells the client to ask for the...
Read more >Uncaught TypeError: Cannot read property of undefined In
Uncaught TypeError : Cannot read property of undefined error occurs in Chrome when you read a property or call a method on an...
Read more >Cannot read property '0' of undefined when trying to display data
When I try to display patient details, It is showing " Uncaught TypeError: Cannot read property '0' of undefined" Below is the code...
Read more >How to Read React Errors (fix 'Cannot read property of ...
This error usually means you're trying to use .map on an array, but that array isn't defined yet. That's often because the array...
Read more >Help With "Cannot Read Property '0' Undefined"
"Of undefined" is the key part of the error message. It basically means that the engine tried to access a data object that...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@smartm0use Ok, here’s a proposal: If you add the static property
data-percent
(without any binding) to the progress element, then your approach, by changing the inline style width via Angular binding, also works with FUI 2.7.4+ (without JS instantiation through FUI) Please trywith FUI 2.7.4
See https://jsfiddle.net/jcgybd9m/
Yes, it worked, thank you!