ujjwalguptaofficial/mahal

model directive not working for checkbox, radio buttons, and select

mrez0 opened this issue · 6 comments

mrez0 commented

Summary

"model" directive to be improved to include two-way data binding with different HTML elements such as checkbox, select, textarea.

Thanks for adding the issue @mrez0, will work on it.

fixed in v - 1.8.1 @mrez0 , please check and let me know.

mrez0 commented

Thanks @ujjwalguptaofficial for the updates.

Works great for checkbox, radio buttons, and textarea.

For "select" the binding is working from HTML to JS, but not the other way from JS to HTMl.
For example, when "select" is bound to a string in the component class, it does not show the correct option in the select element.
Also, when changing the select value in JS code, it does not reflect that value to the select element in HTML.

Another issue (I don't know if I need to open another issue for that or not) is that the command "npx @mahaljs/creator init" shall install the last updated version of the framework. Currently, it is installing the framework @Version 1.5.0

oh my bad - forgot to handle the select, handled in v - 1.8.2. Please check and let me know.

I have added the test for each input type with different cases, please check here - https://github.com/ujjwalguptaofficial/mahal/blob/master/tests/typescript/test/model.test.ts and let me know if i am missing something.

also regarding the latest version in mahal-creator - this has been done deliberately to not to update to latest version as things might not be stable in each version - i am keeping the package stable in the creator.

mrez0 commented

All works perfectly. Thanks