valor-software / ngx-bootstrap

Fast and reliable Bootstrap widgets in Angular (supports Ivy engine)
https://valor-software.com/ngx-bootstrap
MIT License
5.53k stars 1.69k forks source link

Daterangepicker problems when compiling (--prod) #5730

Closed devailtonmereo closed 4 years ago

devailtonmereo commented 4 years ago

Versions of ngx-bootstrap, Angular, and Bootstrap:

ngx-bootstrap: 5.6.0

Angular: 8.2.14

Bootstrap: 3.4.1


I'm trying to compile the project and I get an error on the console, the error is in the Daterangepicker component.

I noticed that the error is in the json file (ngx-bootstrap-datepicker.metadata.json) that is imported into the project.

There are no references to:

Here (ngx-bootstrap-datepicker.metadata.json):

<div class=\"bs-datepicker-custom-range\" *ngIf=\"customRanges?.length > 0\">\n    
           <bs-custom-date-view \n      [selectedRange]=\"chosenRange\" \n      [ranges]=\"customRanges\"\n      (onSelect)=\"setRangeOnCalendar($event)\">\n    
           </bs-custom-date-view>
</div>

The error happens only in --prod.

image

Thanks in advance. Hugs

daniloff200 commented 4 years ago

hey @devailtonmereo

I should say, that, chosenRange is a new property, which was added in https://github.com/valor-software/ngx-bootstrap/pull/5580, and that's only for daterangepicker, not for datepicker.

Can you show me the code snippet, when you use a datepicker / daterangepicker? Did you use ranges property there ?

I've also tried to build a production build for our demo application, and didn't get any error.

Could you provide a small demo (Stackblitz) or github repo, when I can reproduce that issue?

devailtonmereo commented 4 years ago

Good afternoon!

I did a test project here on github. Any questions I put the steps in the README.

You just need to import the Datepicker into the project and compile the application with the --prod that the error already appears.

https://github.com/Devailton/angular-vicgyv

Error: image

hug

sangdangq commented 4 years ago

I have same issue.

ahmedsherifm commented 4 years ago

@daniloff200 I have the same issue even after updating ngx-bootstrap to latest version 5.6.1.

Any updates when this fix will be available?

devailtonmereo commented 4 years ago

Problem persists after the update.

daniloff200 commented 4 years ago

Fix will be in next version, I suppose, that will be 5.6.2, that's why you can't see changes @devailtonmereo

daniellnog commented 4 years ago

I have the same issue, do you have some predictions about the availability of the new version with this fix?

Thanks.

ahmedsherifm commented 4 years ago

@daniellnog I believe it is fixed for 3 weeks now

daniellnog commented 4 years ago

@ahmedsherifm I have already the newest version (5.6.1) and the same issue is happening yet...

The solution that I found was to downgrade the version to 5.1.0 and it solve my problem...

ahmedsherifm commented 4 years ago

@daniellnog I think the newest version is 5.6.2, that's what I'm using. Anyway try after installing it to remove your node_modules folder and run npm install again that may help

daniellnog commented 4 years ago

@daniellnog I think the newest version is 5.6.2, that's what I'm using. Anyway try after installing it to remove your node_modules folder and run npm install again that may help

lol, when I type npm show ngx-bootstrap version, the version that is showed for me is 5.6.1

daniellnog commented 4 years ago

@ahmedsherifm when I check on the website: https://www.npmjs.com/package/ngx-bootstrap

the actual version is 5.6.1 yet...

HadyAllam commented 4 years ago

@daniellnog for some reasons they didn't switch to 5.6.2 as latest version. always it points as it's the next one. any way try to upgrade to 5.6.2 and it will work with you

image

daniellnog commented 4 years ago

@HadyAllam thank you man, I'll try it.

Thank you @ahmedsherifm too.

Emprint commented 4 years ago

Latest version is still not up to date, had to install specific version to solve this issue npm install ngx-bootstrap@5.6.2

suosiyaz commented 4 years ago

Try an older version. I tried version 5.2.0 and is working fine. I was using 5.6.1 and got the same issue. Hope it will be helpful for some.

Emprint commented 4 years ago

Yes older versions are compiling fine but if you need a new feature like UseUtc, you want one of the latest versions (after 5.2) and if you just install the latest proposed by npm without installing specifically the 5.6.2, you get 5.6.1 that is having this error so team need to promote 5.6.2 to latest.

khaledelkholy83 commented 4 years ago

@HadyAllam thanks a lot. I ran npm unistall ngx-bootstrap as I had 5.6.1, then installed 5.6.2 and worked fine :)

upanshus commented 4 years ago

@khaledelkholy83 thanks bro . i was also stuck in same problem. i change npm boostrap 5.6.1 to npm boostrap 5.6.2 then my 'ng build --prod' command run. worked fine. :)