# כיצד להשתמש ב-api.onPageChange עם api.createWidget?

**URL:** <https://meta.discourse.org/t/how-to-use-api-onpagechange-with-api-createwidget/242744>\
**Category:** Development\
**Tags:** ember\
**Created:** [24 באוקטובר,‏ 2022,‏ 2:55am UTC](https://meta.discourse.org/t/how-to-use-api-onpagechange-with-api-createwidget/242744 "2022-10-24T02:55:24Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![rahim123](https://avatars.discourse-cdn.com/v4/letter/r/df705f/32.png) [@rahim123](https://meta.discourse.org/u/rahim123)\
**Post date:** [24 באוקטובר,‏ 2022,‏ 2:55am UTC](https://meta.discourse.org/t/how-to-use-api-onpagechange-with-api-createwidget/242744/1 "2022-10-24T02:55:24Z")

</div>

Hi there, I’m trying to add an image banner to all pages that picks randomly from two random images. It works when I add it to my theme’s **Head** section and hard reload the homepage:

_ **EDIT:** _ _My attempt that gets closer to the solution is here:_  
[How to use api.onPageChange with api.createWidget? - #2 by rahim123](https://meta.discourse.org/t/how-to-use-api-onpagechange-with-api-createwidget/242744/2)

Any idea what I’m doing wrong? Thanks!

---

_[View the full topic](https://meta.discourse.org/t/how-to-use-api-onpagechange-with-api-createwidget/242744)._
