How to pass the BeforeRender a parameter coming from the front (AngularJS)

  • Hello my friends,

    I'm new at JsReport and I'm trying to implement using AngularJS. My question is how to send parameters so that the BeforeRender script receives and sends to my REST API. Below is how my codes are.

    My beforeRender() script

    My Service

    My controller

    My view

    I think you've been well explained. I look forward to a comeback from friends.

  • administrators

    hi, the parameters of beforeRender are the following:

    function beforeRender(req, res, done) {

    in you will have anything that you send from your angularjs app, for example, if in you angular controller you send something like this:

    var parameter = {
      "template": {
        "shortid": "ryGK3xp4W"
      "data" : {
         "foo": "bar"

    you will be able to access all data passed from your angular app (in this example: { foo: "bar" }) using in the beforeRender function, then in beforeRender you can use those values to send a request to your server to get more values an set with more values (or just the response of your REST API), as you are already doing.

  • Thank you, my friend. It worked perfectly!

    This way I can send parameters to my WebService to filter information.

    My beforeRender
    0_1499773791975_beforeRender 2.fw.png

    My Controller
    0_1499773810278_controller 2.fw.png

Log in to reply

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.