dart - Setting a bool published attribute with @published -
dart - Setting a bool published attribute with @published -
i have next .dart component
class="lang-dart prettyprint-override">@customtag('description-form') class descriptionform extends polymerelement { @observable map<string, dynamic> datamap = {}; @observable string description = ''; @published string label => readvalue(#label); set label(string value) => writevalue(#label, value); @published bool isvisible => readvalue(#isvisible); set isvisible(bool value) => writevalue(#isvisible, value); descriptionform.created() : super.created(); void publish() { datamap['description'] = description; } @override void attached() { super.attached(); datamap['receiver'] = dataset['receiver']; } }
to utilize published attributes, next in form
class="lang-dart prettyprint-override"> <description-form label = 'others' isvisible = false data-receiver = 'shared| description-form --> dynamic-chkbx'> </description-form>
while label resolved, isvisible not. right mechanism set bool published using @published
?
typically, boolean attributes work based on whether they're nowadays or not present. if set property in class so:
class="lang-dart prettyprint-override">@publishedproperty(reflect: true) bool isvisible = true;
then can utilize in html this:
class="lang-dart prettyprint-override"> <description-form label = 'others' isvisible data-receiver = 'shared| description-form --> dynamic-chkbx'> </description-form>
when isvisible
nowadays on tag, it's true
in class, , changing class's property false
removes attribute on tag (thanks reflect: true
).
hope helps!
dart dart-polymer
Comments
Post a Comment