Hi Chanaka,

We can send the app context from the server side to client side using
*sendToClient
*function. You can use *sendToClient* function inside the *onRequest*
function like this.

function onRequest(env) {
    sendToClient("contextPath", env.contextPath);
}


Then the *contextPath* variable will be added at the end of the html
body like below and then you can get the app context in the client
side using *contextPath* variable.

<script type="text/javascript">var contextPath="/test";</script>

Thanks,
Shan.


On Mon, Dec 19, 2016 at 12:08 PM, Chanaka Jayasena <chan...@wso2.com> wrote:

> Hi guys,
>
> We are doing the routing from the client side. So we want to read the app
> context from javascript. Is there a nice way to do this without adding a
> <script> var context = '{{@config.context}}'; </script>?
>
> It the @config is available in the client side it will be a nice feature
> addition to UUF.
>
> thanks,
> Chanaka
>
> --
> Chanaka Jayasena
> Associate Tech Lead,
> email: chan...@wso2.com; cell: +94 77 4464006 <+94%2077%20446%204006>
> blog: http://chanaka3d.blogspot.com
>
> _______________________________________________
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Shan Mahanama

Software Engineer, WSO2 Inc. http://wso2.com
<http://l.facebook.com/l.php?u=http%3A%2F%2Fwso2.com&h=gAQEswASa>
Email: sh...@wso2.com
Mobile: +94 71 2000 498
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to