SSD Unable to set dynamic value to component property in SSD

Hi Team,

@Eldho @Shamnad_KS @Simphiwe

I have created a new “Range slider” component in SSD for my project, I am trying to dynamically set the min and max attribute from page variable.

I tried with both property binding[min] and [max] and also using {{}} operator, but the value is not rendering in range field

HTML file:

        <evo-range-slider min="{{page.min}}" max="{{page.max}}" step="1" prefix="$\[" suffix="\]" \[min\]="page.min" \[max\]="page.max"></evo-range-slider>

      </div>

      <div class="pb-6">

        <p>Min: {{ page.min }} | Max: {{ page.max }}</p>

      </div>

Template :

get template() {

  let Component = require('@jatahworx/bhive-toolkits').Component;
let Attribute = require('@jatahworx/bhive-toolkits').Attribute;

module.exports = class EvoRangeSlider extends Component {
    constructor() {
        const name = "evo-range-slider";
        const designerTemplate = `<div class=\"drop\" component-label="Evo Range Slider"></div>`;
        const paletteTemplate = "Evo range slider";
        const componentLabel = "Evo range slider";
        const templateUrl = '';
        const visible = true;
        super({
            name,
            designerTemplate,
            paletteTemplate,
            componentLabel,
            templateUrl,
            visible
        });
        super.addAttribute(
            new Attribute({
                key: 'min',
                value: '0',
                type: 'kv'
            })
        );
        super.addAttribute(
            new Attribute({
                key: 'max',
                value: '100',
                type: 'kv',
            })
        );
        super.addAttribute(
            new Attribute({
                key: 'step',
                value: '1',
                type: 'kv'
            })
        );
        // super.addAttribute(
        //     new Attribute({
        //         key: 'default-value',
        //         value: '0',
        //         type: 'kv'
        //     })
        // );
        super.addAttribute(
            new Attribute({
                key: '[(ngModel)]',
                value: '',
                type: 'kv'
            })
        );
        super.addAttribute(
            new Attribute({
                key: 'input-id',
                value: '',
                type: 'kv'
            })
        );
        super.addAttribute(
            new Attribute({
                key: 'title-copy',
                value: '',
                type: 'kv'
            })
        );
        super.addAttribute(
            new Attribute({
                key: 'custom-min-label',
                value: '',
                type: 'kv'
            })
        );
        super.addAttribute(
            new Attribute({
                key: 'custom-max-label',
                value: '',
                type: 'kv',
            })
        );
        super.addAttribute(
            new Attribute({
                key: 'prefix',
                value: '',
                type: 'kv',
            })
        );
        super.addAttribute(
            new Attribute({
                key: 'suffix',
                value: '',
                type: 'kv',
            })
        );
        super.addAttribute(
            new Attribute({
                key: 'error-messages',
                value: '',
                type: 'kv',
            })
        );
        super.addAttribute(
            new Attribute({
                key: '[a11y-aria-required]',
                value: '',
                type: 'kv',
            })
        );
        super.addAttribute(
            new Attribute({
                key: 'a11y-aria-label',
                value: '',
                type: 'kv',
            })
        );
        super.addAttribute(
            new Attribute({
                key: '(change)',
                value: '',
                type: 'kv',
            })
        );
        super.addAttribute(
            new Attribute({
                key: '(input)',
                value: '',
                type: 'kv',
            })
        );

        super.setType(Component.COMPONENT_TYPE_TITLES.OTHERS.val);
    }
    get template() {
        const template = `<evo-range-slider %min% %max% %step% %[(ngModel)]% %input-id% %title-copy% %custom-min-label% %custom-max-label% %prefix% %suffix% %error-messages% %[a11y-aria-required]% %a11y-aria-label% %(change)% %(input)% %bCustomProps%></evo-range-slider>`;
        return template;
    }
    set template(templateString) { }
}

Hi @Vignesh-U,

Binding variable to basic properties in the slider doesn’t require string interpolations.
You can just use page.min and page.max without {{}}

I have attached the link below for slider link documentation.
Slider

1 Like

Hi @Simphiwe ,

Tried using page.min and page.max but it is not working, getting NaN but you can see it is number in console

@Vignesh-U,

Can you share how you bound the one that is showing NaN.

@Simphiwe here is the screen shot


In HTML page it is showing like below

        <evo-range-slider min="page.min" max="page.max" step="1" prefix="$\[" suffix="\]"></evo-range-slider>

      </div>
1 Like

@Vignesh-U,

Did you try adding actually values to min and max ??

Yeah @Simphiwe I can add static values but not dynamic one

1 Like

@Sam @Simphiwe can you please support