PeterStaev / NativeScript-Drop-Down

A NativeScript DropDown widget.
Apache License 2.0
105 stars 65 forks source link

css class must be a binding (possible documentation needed?) #172

Closed jdmcnair closed 6 years ago

jdmcnair commented 6 years ago

https://github.com/PeterStaev/NativeScript-Drop-Down/blob/3965bd8581810a2f93e8217b011dff4806827e8b/demo-ng/app/dropdown/dropdown.component.html#L6

It appears on first blush, after playing around a bit with the class attribute, that the value must be a binding to actually be applied to the element itself and the child elements. Is this the intended behavior? If it is the intended behavior, it may be worth an explanatory line or two in the documentation. If it's not the intended behavior, is there a bug?

PeterStaev commented 6 years ago

Hey @jdmcnair , that is a wrong assumption. I've just tested the demo app and the class attribute works just as it does on any other NativeScript control - i.e. it can be either binding or simple attribute value.

jdmcnair commented 6 years ago

Hi @PeterStaev, thanks for having a look. Just to clarify what I'm seeing, it looks like both of these work:

<DropDown #dd [class]="someBoundPropertyWithClassName"></DropDown>
<DropDown #dd [class]="'some-class-name'"></DropDown>

But the following does not cause the class to be applied to the dropdown and its child selections:

<DropDown #dd class="some-class-name"></DropDown>

Are you saying you just tried this third method of applying a class, and it actually does work? If so, maybe I need to try something different.

PeterStaev commented 6 years ago

That is correct. I changed in the demo app [class]="cssClass" to class="default" and the control is styled correctly.

PeterStaev commented 6 years ago

No further response so closing this one for now. In case you still have problems, please provide more details.