简体   繁体   中英

Trigger polymer iron-ajax request manually

document.getElementById('test').addEventListener('options-changed', function () {
        document.getElementById('getContent').generateRequest();
    });

The example above works perfectly fine. But as soon as I try to use generateRequest(); in a custom element nothing happens. No Errors.

Polymer({
        is: 'vplan-table',

        properties: {
            options: {
                reflectToAttribute: true,
                notify: true,
                observer: '_optionsChanged'
            }
        },
        _optionsChanged: function() {
            //generateRequest not working!
            document.querySelector('#getContent').generateRequest();
            console.log('options changed');
        }
    });

Thanks for your time!

Alan's solution works! Use this.$.getContent.generateRequest() instead of document.querySelector('#getContent').generateRequest() . Thanks a lot Alan !

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM