ng-admin-pro-5.2.3 ERROR Object is possibly 'null'

MDB SupportCategory: MDB Angularng-admin-pro-5.2.3 ERROR Object is possibly 'null'
LifeQube Pro User asked 3 months ago in MDB pro, version:5.2.3

MDB – Angular Admin Dashboard 5.2.3

I purchased the ng-admin-pro-5.2.3 template. Dowloaded, unzipped, ran npm i. When I run ng serve I get this error:

ERROR in src/app/typescripts/pro/file-input/classes/mdb-uploader.class.ts(234,90): error TS2531: Object is possibly ‘null’.
src/app/typescripts/pro/file-input/classes/mdb-uploader.class.ts(239,29): error TS2345: Argument of type ‘File | null’ is not assignable to parameter of type ‘string | Blob’.
Type ‘null’ is not assignable to type ‘string | Blob’.
src/app/typescripts/pro/file-input/classes/mdb-uploader.class.ts(239,41): error TS2531: Object is possibly ‘null’.

Please advise

 

 

Damian Gemza replied 3 months ago

Dear LifeQube,
Please open /src/app/typescripts/pro/file-input/classes/mdb-uploader.class.ts file and find lines 233 (const uploadFile) and 234 (const uploadIndex). Add to this lines types : any.
So instead of:
const uploadFile = this.fileList.item(file.fileIndex);
const uploadIndex = this.uploads.findIndex((upload: any) => upload.file.size === uploadFile.size);
There should be
const uploadFile: any = this.fileList.item(file.fileIndex);
const uploadIndex: any = this.uploads.findIndex((upload: any) => upload.file.size === uploadFile.size);

After this, Admin Template should work fine. If not, let me know. It will be fixed in next release.
Best Regards,
Damian

3 Answers
LifeQube Pro User answered 3 months ago

Thank you Damian, that error has been resloved and I can now serve the app. Now I am getting this error in the console:

Dashboard1Component.html:43 ERROR TypeError: Cannot read property ‘duration’ of undefined
at SimpleChartComponent.ngOnInit (chart-simple.component.ts:52)
at checkAndUpdateDirectiveInline (core.js:12369)
at checkAndUpdateNodeInline (core.js:13893)
at checkAndUpdateNode (core.js:13836)
at debugCheckAndUpdateNode (core.js:14729)
at debugCheckDirectivesFn (core.js:14670)
at Object.eval [as updateDirectives] (Dashboard1Component.html:64)
at Object.debugUpdateDirectives [as updateDirectives] (core.js:14655)
at checkAndUpdateView (core.js:13802)
at callViewAction (core.js:14153)

Damian Gemza answered 3 months ago

Open /src/app/views/dashboards/dashboard1/dashboard1.component.html and in line 64 (mdb-simple-chart) add this code: [animate]=”{duration: 1000, enabled: true}”.
After changes this line should look like below:

<mdb-simple-chart [percent]="56" [barColor]="'FF5252'" [animate]="{duration: 1000, enabled: true}"></mdb-simple-chart>

This also will be fixed in next release.

LifeQube Pro User answered 3 months ago

Thanks Damian. That worked. Strangely , when I serve in Chrome (on windows) , neither the side menu or top menu are visible. Any ideas what I should be looking at to fix this ?

Damian Gemza replied 3 months ago

You have to write an email at contact@mdbootstrap.com. My friend will provide you access to GitLab repo.

LifeQube Pro User replied 3 months ago

If I use the username and password from my account I cant login to the gitgub repo. What username and password should I be using?

Damian Gemza replied 3 months ago

Dear LifeQube,
Problems with navbars which you’ve showed me on screenshots are already solved. Please download Angular Admin Template from our GitLab repo: https://git.mdbootstrap.com/mdb/angular/ng-admin-pro
Best Regards,
Damian

Damian Gemza replied 3 months ago

Post in new message instead of comment or paste me here links

LifeQube Pro User replied 3 months ago

Sure, how do I post screen shots here?

Damian Gemza replied 3 months ago

Could you show me some screenshots?

LifeQube Pro User replied 3 months ago

In Firefox and Explorer the left side menu is visible but not the top menu. In Chrome neither menu is visible. There is a black white bar on the top but none of the menu content shows (in all browsers)

Damian Gemza replied 3 months ago

Sidenav and Navbar should be always visible there, so it’s right behavior. Does on other browsers nav isn’t visible?