Monaca Onsen UI Discord Chat Github Repo

Sample for createPopover with Angular 2+



  • Hi
    Can anyone please post a sample for creating a popover in angular 2?
    I don’t know, how it works with templates and reference it within the createPopover method.
    in my.component.html I have this:

    <ons-page>
    <ons-button (click)="myClick()">Test</ons-button>
    </ons-page>
    <template id="popover.html">
      <ons-popover #popover>
        This popover is defined as a template.
      </ons-popover>
    </template>
    

    and in my.component.ts I have this:

      public myClick() {
        ons.createPopover('popover.html')/*.then(function(popover) {
          alert(popover);
        })*/;
      }
    

    I get errors like
    ERROR Error: Uncaught (in promise): TypeError: Cannot read property ‘remove’ of undefined

    Thank you



  • what a great community here!