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.

getting NaN on minimum price or maximum

See original GitHub issue

I’m always getting NaN on minimum price and maximum, If the tow value s comes from a HTTP response. Maybe I should show the value asynchronsly any way.

This my component:

export class PriceFilterComponent implements OnChanges {
    @Input() floor;
    @Input() ceil;
    @Output() eventEmitterFilter = new EventEmitter<{}>();
    min: any;
    max: any;

    options: Options;

    ngOnChanges() {
        console.log(this.max); //undifined then NaN
        if (this.floor && this.ceil) {
            console.log(this.max); // NAN
            this.max = Number(this.ceil.toFixed(0)) || 0;
            this.min = Number(this.floor.toFixed(0)) || 0;

            this.options = {
                floor: this.floor,
                ceil: this.ceil,
                showSelectionBar: true,
                selectionBarGradient: {
                    from: 'white',
                    to: '#007bff'
                },
                showOuterSelectionBars: true,
                translate: (value: number, label: LabelType): string => {
                    return value + '€';
                }
            };
        }
    }

    filter() {
        this.eventEmitterFilter.emit({'ceil': this.max, 'floor': this.min});
    }
}

This is the html side:<ng5-slider class="custom-slider" [(value)]="min" [(highValue)]="max" [options]="options" ></ng5-slider> This a link for a deployed app Online demo, and the part of code source could be found here.https://github.com/ahmed-bhs/angular6-demo/blob/master/src/app/article/price-filter/price-filter.component.ts

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
piotrdzcommented, Jan 14, 2019

Can you please re-test your code with v1.1.12?

1reaction
piotrdzcommented, Jan 13, 2019

I just added a fix for a bug from #56. I think it should solve the problem of NaN values in this case.

Read more comments on GitHub >

github_iconTop Results From Across the Web

getting NaN on minimum price or maximum · Issue #54 - GitHub
I'm always getting NaN on minimum price and maximum, If the tow value s comes from a HTTP response. Maybe I should show...
Read more >
max() and min() returns np.nan when the np array starts with ...
NaN values are propagated, that is if at least one item is NaN, the corresponding max value will be NaN as well. To...
Read more >
Cost function turning into nan after a certain number of iterations
Well, if you get NaN values in your cost function, it means that the input is outside of the function domain. E.g. the...
Read more >
What does NaN mean? - Flexera CMP Docs
NaN is short for Not a Number. NaN indicates that the monitoring system is not receiving any numeric data. There can be several...
Read more >
How to Use min() and max() in R - DigitalOcean
The min and max functions can be used in both numerical as well as character vectors. You can also remove the NA values...
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