error on mdbBtn

declan.ward pro premium priority asked 3 years ago

I have mdb 12.0.0 installed (according to changelog) running Angular 12.2.3

*_Expected behavior_*Clean compile (ng serve)

*_Actual behavior_*Error: src/app/app.component.html:68:11 - error TS2322: Type 'string' is not assignable to type 'boolean'.

<a mdbBtn floating="true" size="lg" gradient="purple" mdbWavesEffect>

It is complaining about floating="true"

enter image description here

enter image description here *_Question_*Sorry for dumb question but what may I have missed?


declan.ward pro premium priority answered 3 years ago

Through trial and error I discovered a setting in tsconfig.json that caused the problem.

Changing "strictTemplates": true

to "strictTemplates": false

solved my problem.


Arkadiusz Idzikowski staff commented 3 years ago

@declan.ward In this case you can also use syntax with square brackets to make sure that this value is of type boolean before Angular converts it from string to boolean. For example [floating]="true"


declan.ward pro premium priority commented 3 years ago

Perfect, thank you.


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue
  • User: Pro
  • Premium support: Yes
  • Technology: MDB Angular
  • MDB Version: MDB4 11.1.0
  • Device: Desktop
  • Browser: FF
  • OS: Windows 10
  • Provided sample code: No
  • Provided link: No
Tags