angularjs - Is there something similar to angular $rootScope in Polymer.dart? -
i know in angular exists called $rootscope. 1 contains variables going shared controllers. i'm looking similar polymer, don't need pass parent variable attributes always.
right i'm doing similar this:
index html code:
<body> <my-parent-component some-attribute="hello"></my-parent-component> </body>
parent html code:
<my-parent-component> <template> <p>someattribuet used parent: {{someattribute}}</p> <my-child-component some-attribute="{{someattribute}}"></my-child> </template> </my-parent-component>
parent dart code:
class myparentcomponent extends polymerelement { @published var someattribute; }
child html code:
<my-child-component> <template> <p>some attribute used here: {{someattribute}}</p> </template> </my-child-component>
child dart code:
class mychildcomponent extends polymerelement { @published var someattribute; }
in other words, i'm passing attribute way down top parent until lowest child. think not , similar $rootscope in angular.
polymer doesn't have root scope. in polymer there element , maybe parent elements or child elements can reference in expression. more generic solution global variables or globals element explained here https://stackoverflow.com/a/29864797/217408
Comments
Post a Comment