Monday 13 January 2020

How we can get script response methods on runtime in angular JS

I am calling a script URL in the response I need to use the response which contains a method. I need to implement that method in my code. Please suggest if anybody has the solution

I have the below URL and I calling script URL in Directive

script URL = https://botsrv.com/qb/widget/xxxxx/xxxxx

This is my Directive -

directive('demo',[ function () {
    return {
        restrict: 'A',
        link: function(scope, el , attrs) 

            var scriptElem = angular.element(document.createElement('script'));
            scriptElem.attr("src", 'https://botsrv.com/qb/widget/xxxxxx/xxxxx'); // set var appropriately
            el.append(scriptElem);

        }
    };
}])

the script having onSave method This is the method - I need the results from the onSave function in my JS Controller.

onSave: function (results) {
    console.log('onSave method ---- ' , results);
 }


from How we can get script response methods on runtime in angular JS

No comments:

Post a Comment