Im pretty new to polymer 2.0 and am trying to get my head around certain errors i dont seem to understand.
One of them being this:
Uncaught ReferenceError: drawer is not defined at HTMLElement.onclick
So to explain my problem, I am trying to use app-drawer
which will slide from left to right on a click event. But the click event returns the above error. How can I make sure the drawer is defined? (Btw, I'm following the code snippet that is provided in the main website of app-layout
section. - https://www.webcomponents.org/element/PolymerElements/app-layout).
Here is my code:
<app-header reveals>
<app-toolbar>
<paper-icon-button icon="menu" onclick="drawer.toggle()"></paper-icon-button>
<div main-title>My app</div>
<paper-icon-button icon="delete"></paper-icon-button>
<paper-icon-button icon="search"></paper-icon-button>
<paper-icon-button icon="close"></paper-icon-button>
<paper-progress value="10" indeterminate bottom-item></paper-progress>
</app-toolbar>
</app-header>
<app-drawer id="drawer" swipe-open></app-drawer>
This is exactly the same in the website, so why does it work for them, but not me.
The problem occurs when i click on the menu icon.
Please help.
Thanks