Search code examples
javascripthtmlpolymer-1.0paper-elements

Uncaught TypeError paper-dialog polymer


so i am trying to get paper-dialog to show up once i click on a FAB but i get this error,

Uncaught TypeError: Cannot read property 'toggle' of undefined

Paper dialog

<paper-dialog id="dialog1">
              <p>{{item.name}}</p>
</paper-dialog>

paper-FAB

<paper-fab icon="shopping-cart" title="hire" on-click="hire"></paper-fab>

script

hire: function(e){
            this.$$['#dialog1'].toggle();
            console.log("click");
          }

Solution

  • Using this.$['...'] only works inside of a registered polymer component. I'm guessing you're trying to use it inside a dom-repeat.

    Try creating an component instead, and it will work.

    See: http://jsbin.com/gubesa/edit?html,output