I have a simple component that contains a list of employees defined as following:
@Component(selector: 'employee-list', templateUrl:
'employee_list.html', cssUrl: 'employee_list.css')
class EmployeeListComponent extends ShadowRootAware {
...
}
I would like to use a PaperFab
element in my code, as an action button and would like to alter it on the fly (e.g. change the icon).
There is a link to the element definition in the HTML:
<link rel="import" href="packages/paper_elements/paper_fab.html">
Creating the element programmatically:
var fab = new PaperFab();
print(fab is PaperFab) // false
or
var fab = new Element.tag('paper-fab') as PaperFab;
// Casts error: type 'HtmlElement' is not a subtype of type
// 'PaperFab' in type cast.
The same happens when selecting the element through the
var fab = _shadowRoot.querySelection("#fabButton");
print(fab is PaperFab) // false
Is it possible to access paper elements from a custom element? Or should you use the innerHTML
instead, which could work but breaks the component idea.