Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
bijay
Contributor II
Contributor II

REST API call through Angular extension

There is a need to fetch data from a REST API on selection of filter on the Analysis sheet. For that I am trying to write a simple REST call through Angular extension but its not retrieving any data from the resource. Below is the js file.

define( ["qlik", "text!./template.html", "angular"],
function ( qlik, template, angular ) {

return {
template: template,
support: {
snapshot: true,
export: true,
exportData: false
},
paint: function () {
return qlik.Promise.resolve();
},
controller: ['$scope','$http', function ( $scope, $http) {
//add your rendering code here
$http.get("https://www.w3schools.com/angular/welcome.htm")
.then(function(response) {
$scope.html = response.data;
});
// $scope.html = "Hello World";
//$scope.html = angular.version ;
}]
};

} );

 

and the template. html is as below:

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.7.2/angular.min.js"></script>
<div qv-extension style="height: 100%; position: relative; overflow: auto;" class="ng-scope">
{{ html }}
</div>

Appreciate any suggestion here.

Labels (1)
1 Solution

Accepted Solutions
bijay
Contributor II
Contributor II
Author

the issue was with the CORS policy with https://www.w3schools.com/angular/welcome.htm. It works fine with other REST end points.

Also there is no need to add angular.min in the template.html

View solution in original post

1 Reply
bijay
Contributor II
Contributor II
Author

the issue was with the CORS policy with https://www.w3schools.com/angular/welcome.htm. It works fine with other REST end points.

Also there is no need to add angular.min in the template.html