Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jesse Andrews 162 posts 639 karma points
    Jun 21, 2019 @ 18:22
    Jesse Andrews
    0

    Custom Provider retrieves boolean as string instead of boolean

    I'm running into an issue with how the settings are initialized in the config section. Boolean flags are strings in vm.settings when it is initialized. It's not difficult to work around, but it would be nice to have boolean flags returned as booleans. Currently I have

    <umb-control-group label="Sandbox Mode" description="Enable sandbox mode.">
       <umb-toggle checked="vm.settings.sandboxMode === 'true' || vm.settings.sandboxMode === true"
                on-click="pvm.toggle(vm.settings)">
       </umb-toggle>
    </umb-control-group>
    

    when I would like to be able to do

    <umb-control-group label="Sandbox Mode" description="Enable sandbox mode.">
       <umb-toggle checked="vm.settings.sandboxMode" //changed checked expression
                on-click="pvm.toggle(vm.settings)">
       </umb-toggle>
    </umb-control-group>
    

    In the checked expression, "false" evaluates to true, so I currently have to add a couple additional checks to handle that.

Please Sign in or register to post replies

Write your reply to:

Draft