Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Datepicker error when builds app Angular #4795

Closed
Faqtt0 opened this issue Nov 12, 2018 · 12 comments
Closed

Datepicker error when builds app Angular #4795

Faqtt0 opened this issue Nov 12, 2018 · 12 comments

Comments

@Faqtt0
Copy link

Faqtt0 commented Nov 12, 2018

The component works properly, but when you runs build the angular, you can't see the values, just letters on the datepicker.
My version "ngx-bootstrap": "^3.1.1",
Build image 1
screenshot_1prod

Build image 2
screenshot_2prod

In the html file
<input #dtLanc="bsDatepicker" formControlName="data" placeholder="Data Lançamento" class="form-control text-center" bsDatepicker [maxDate]="maxDate">

component
`import {BsDatepickerConfig, BsDatepickerDirective, BsLocaleService} from 'ngx-bootstrap';
import {defineLocale} from 'ngx-bootstrap/chronos';
defineLocale('pt-br', ptBrLocale);
....
@ViewChild(BsDatepickerDirective) datepicker: BsDatepickerDirective;
locale = 'pt-br';
colorTheme = 'theme-blue';
bsConfig: Partial;
....
maxDate = new Date();

.....
ngOnInit() {
this.initForm();
this.localeService.use(this.locale);
this.bsConfig = Object.assign({}, {containerClass: this.colorTheme});
}
.....
private initForm() {
this.lancForm = this.formBuilder.group({
id: [0],
emp: ['', [Validators.required, CustomValidators.validateAutoCompletePrime('empresa')]],
/emp: [{
empresa: [null]/!
,
nome: [null],!/
}, Validators.required],
/
data: [new Date(), Validators.required],
valor: ['0.0', Validators.required],
usuario: ['', [Validators.required, CustomValidators.validateAutoCompletePrime('userId')]]
});
}
`
package.json

"dependencies": { "@amcharts/amcharts4": "^4.0.0-beta.39", "@angular/animations": "^6.0.3", "@angular/common": "^6.0.3", "@angular/compiler": "^6.0.3", "@angular/core": "^6.0.3", "@angular/forms": "^6.0.3", "@angular/http": "^6.0.3", "@angular/platform-browser": "^6.0.3", "@angular/platform-browser-dynamic": "^6.0.3", "@angular/router": "^6.0.3", "@fortawesome": "latest", "@fortawesome/fontawesome-free": "^5.4.2", "bootstrap": "^4.1.3", "chart.js": "^2.7.2", "core-js": "^2.5.4", "deep-equal": "^1.0.1", "font-awesome": "^4.7.0", "jquery": "^3.3.1", "jwt-decode": "^2.2.0", "ngx-bootstrap": "^3.1.1", "ngx-device-detector": "^1.3.0", "popper.js": "^1.14.3", "primeicons": "^1.0.0-beta.10", "primeng": "^6.1.4", "rxjs": "^6.0.0", "zone.js": "^0.8.26" }

ng build --prod --base-href=/apptest/

No build image 1
noprod1
No build image 2
noprod_2

@valorkin
Copy link
Member

@Faqtt0 we will need some small repo to reproduce please
is there are any errors in the console?
@Domainv looks serious

@pehu71
Copy link

pehu71 commented Nov 12, 2018

Hi everyone, since I'm facing the same issue at work, I made the repro-repo:
https://github.com/pehu71/issue4975-demo
notes written in README.md.
In my opinion the UglifyJSPlugin is the culrpit, but it's just first feel.

@Domainv
Copy link
Contributor

Domainv commented Nov 13, 2018

@valorkin It's same issue with #4752
The problem occurs when buildOptimizer is enabled.
I am working on avoiding the problem

@Domainv
Copy link
Contributor

Domainv commented Nov 13, 2018

@Faqtt0 For now, a temporary solution is a turn off buildOptimizer.
Or downgrade from 3.1.1 to 3.0.1

@Faqtt0
Copy link
Author

Faqtt0 commented Nov 13, 2018

Sorry to take a long time to answer. @valorkin it hasn't any error in the console.
I use buildOptimizer = false.
@Domainv I'll downgrade to test it. Thanks a lot.

@Faqtt0
Copy link
Author

Faqtt0 commented Nov 13, 2018

@Domainv i made the downgrade. But it didn't work. I've changed the version in "package.json" and deleted the folder node_modules. After that, i've made the command "npm install" in the console.

@Domainv
Copy link
Contributor

Domainv commented Nov 13, 2018

@Faqtt0 need some small repo to reproduce please

Because problem in this repo https://github.com/pehu71/issue4975-demo @pehu71
solved by switching buildOptimizer to false

@Faqtt0
Copy link
Author

Faqtt0 commented Nov 13, 2018

@Domainv I've made what you asked
https://github.com/Faqtt0/ngxboot-error-datepicker
this project keeps the error with version 3.0.1 with ng build --prod --base-href=/teste/
Just only when disable buildOptimizer works.

@Domainv
Copy link
Contributor

Domainv commented Nov 13, 2018

@Faqtt0
You don't have any ngx-bootstrap versions in package.json
and any using of datepicker in the repo
screenshot from 2018-11-13 14-15-09

@Faqtt0
Copy link
Author

Faqtt0 commented Nov 13, 2018

@Domainv
I'm so sorry. Now it's with all dependencies. Like the other project. i've Commited the other files.

@Domainv
Copy link
Contributor

Domainv commented Nov 14, 2018

@Faqtt0 "ngx-bootstrap": "^3.0.1" change to "ngx-bootstrap": "3.0.1"
then npm install
and it will start work coorectly

@Domainv Domainv closed this as completed Nov 14, 2018
@Faqtt0
Copy link
Author

Faqtt0 commented Nov 14, 2018

@Domainv thanks a lot.
The first time with npm install it didn't work. Then, i had to remove node_modules, execute npm install e clear again the browser.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants