Forum Discussion

javagamer's avatar
8 years ago

Angular: Execute callback after search results are returned

Hi,
 
I’d like to understand how to implement an Angular/JavaScript callback after a search is performed: 

Search URL:https://community.skype.com/t5/forums/searchpage/tab/message

Thanks,

Ronnie

  • Hello, 

     

    There are some events triggered in the client before and after search results are updated that you can add callbacks for:

     

    // Make sure the Lithium specific JS has attached to the page before adding additional listeners.
    LITHIUM.Loader.onLoad(function () { var $ = LITHIUM.jQuery;

    // Triggered after a change is made to the message search form and before the request is sent to the server to update the message list $(document).on('LITHIUM:ajaxBeforeSend:searchRerender', function (event, context) { // do something custom }); // Triggered after a change is made to the message search form and after the request is sent and has successfully responded in the client $(document).on('LITHIUM:ajaxSuccess:searchRerender', function (event, context) { // do something custom });
    });    

    This example is not specific to Angular, but gives you an idea how you can add handlers that may call out to some custom Angular or JavaScript code. You might also find this post useful about how to integrate a custom Angular application into the Angular application used in Community.

2 Replies

  • AdamA's avatar
    AdamA
    Khoros Oracle
    8 years ago

    Hello, 

     

    There are some events triggered in the client before and after search results are updated that you can add callbacks for:

     

    // Make sure the Lithium specific JS has attached to the page before adding additional listeners.
    LITHIUM.Loader.onLoad(function () { var $ = LITHIUM.jQuery;

    // Triggered after a change is made to the message search form and before the request is sent to the server to update the message list $(document).on('LITHIUM:ajaxBeforeSend:searchRerender', function (event, context) { // do something custom }); // Triggered after a change is made to the message search form and after the request is sent and has successfully responded in the client $(document).on('LITHIUM:ajaxSuccess:searchRerender', function (event, context) { // do something custom });
    });    

    This example is not specific to Angular, but gives you an idea how you can add handlers that may call out to some custom Angular or JavaScript code. You might also find this post useful about how to integrate a custom Angular application into the Angular application used in Community.