Pass a parameter through an html click button event

edited June 5 in Technical questions

Hi,

I'm, as the title says, trying to pass a parameter in this line of HTML:

    <div view="button" label="1" autowidth="true" align="center" click="addDriverCodeChar(1)" hotkey="1"></div>

in the controller I have this function in the scope ($scope.addDriverCodeChar = addDriverCodeChar;). If i dont pass the parameter:

    click="addDriverCodeChar" 

it works, but the function is declared like this:

    function addDriverCodeCharacter(value) {
            $$("driverCodeTextBox").setValue($$("driverCodeTextBox").value + value);
        }

So, when i try to pass the parameter, I get this error in the browsers console:
VM4750:1 Uncaught ReferenceError: addDriverCodeCharacter is not defined

Can you plz tip me how to pass a parameter via HTML markup?

Thank you!

Comments

  • This feature is not supported. Parameters of click functions, will be the same as parameters of onItemClick event, there is no way to push custom handler there.

    The "this" inside of function handler must point to the component, so you can access its configuration and read any properties from there.

    Also, I strongly recommend using the JSON based initialization.
    Initialization from HTML markup is limited in its functionality and better be avoided.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion