Highlighted

Not able to consum js use API in sightly

lovepreetk75597

08-05-2019

Hi,

I ma trying to consume js use API in sightly but it is not working. Following are my js and htl files:-

abc.js:-

'use strict';

use(function () {

    alert("inside");

    var message = "Hello World";

    return {

       

        hello: message

    };

});

abc.html:-

<div data-sly-use.logic="abc.js">

    ${logic.hello}

</div>

Ideally it should print "Hello world". Also that alert is not coming.

Am i missing out something?

Thanks in advance.

Regards,

Lovepreet

Replies