user3718704
user3718704

Reputation: 259

How to update polymer element attribute from dart code

I am trying to learn dart and polymer. Here repository that I try to learn on:

https://bitbucket.org/romanoff/polymer_sample

When I try to set attribute from dart code of one custom element to other custom element, it doesn't seem to work. Here is line where I try to do this: https://bitbucket.org/romanoff/polymer_sample/src/f8314627fe8eee9f6fde58c300acf081b396f927/web/clickcounter/clickcounter.dart?at=master#cl-33

Have also tried following options: var timer = $['timer'].xtag; timer.textValue = 'Text value set form attached handler';

var timer = $['timer']; timer.setAttribute('textValue', 'Text value set form attached handler');

Upvotes: 2

Views: 273

Answers (1)

Günter Zöchbauer
Günter Zöchbauer

Reputation: 657058

There are two ways

$['timer'].attributes['textValue'] = 'Text value set form attached handler';

or

import 'path_to_dart_file_containing_timer_component#;

...

($['timer'] as MyTimer).textValue = 'Text value set form attached handler'; 

where MyTimer is the name of the class of your timer element
and your timer component class has a field

@published String textValue;

Upvotes: 1

Related Questions