Search code examples
javascripthtmlaurelia

Aurelia html attribute binding


I would like to bind html attribute "required". I have my template and model. I do pass a lot of info like label value label.bind="fieldLabel" but I would like also pass if element is required or not. Simple required="true/false" or required="required/not-required" does not work. Digging threw web I found some statement that it is not possible, and to do it in Aurelia I need to use pure js .setAttribute(). Is it true? Do I miss something?


Solution

  • Found it. I had small differences. Now: element should have required="isRequired", it should be declared in ts file as boolean, and use looks like is-requider.bind="true/false" thats it folks