2015-12-14 4 views
0

Учитывая следующие элементыКаковы различные способы доступа статический атрибут в полимерно-дротика 1.0.rc

.dart
@PolymerRegister('x-custom') 
class XCustom extends PolymerElement { 
    XCustom.created() : super.created(); 

    static const hostAttributes = const { 
    'string-attribute': 'Value', 
    'boolean-attribute': true, 
    'tabindex': 0, 
    }; 
} 

что приводит динамически в

.html
<x-custom string-attribute="Value" boolean-attribute tabindex="0"> 
</x-custom> 

Каковы различные способы доступа к статически установленным hostAttributes в другом .ht ml и .dart, где x-custom является дочерним?

+0

пожалуйста, вы можете уточните немного больше того, что вы пытаетесь выполнить? –

ответ

0

Настоятельно если вы получите ссылку элемента на один из способов объясняется What are the different ways to look up elements in Polymer 1.0 вы можете сделать

var xCustom = ...; 
print(xCustom.attributes['string-attribute']); 
xCustom.attributes['string-attribute'] = 'otherValue'; 

или декларативно

<dom-module id="some-element"> 
    <template> 
    <x-custom 
     string-attribute="{{someStringProperty}}"> 
    </x-custom> 
    </template> 
</dom-module> 

(не проверено)