Notice: The Monaca & Onsen UI Community Forum is shutting down.

For Onsen UI bug reports, feature requests and questions, please use the Onsen UI GitHub issues page. For help with Monaca, please contact Monaca Support Team.

Thank you to all our community for your contributions to the forum. We look forward to hearing from you in the new communication channels.

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!