question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Progress: Cannot read property '0' of undefined

See original GitHub issue

Hello, 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:closed
  • Created 4 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
lubber-decommented, May 9, 2019

@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 try

<div class="ui tiny green progress" data-percent>
    <div class="bar" [style.width]="file.percent + '%'"></div>
</div>

with FUI 2.7.4

See https://jsfiddle.net/jcgybd9m/

0reactions
smartm0usecommented, May 10, 2019

Yes, it worked, thank you!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found