Languages

Menu
Sites
Language
Code is running with browser but not on tizen emulator.

Hi,

Here is my code.There is no any output.

<!DOCTYPE html>
<html ng-app="myApp">
<head>
    <title>Welcome</title>
    <script type="text/javascript" src="angular.min.js"></script>
    <script type="text/javascript">

var myApp=angular.module('myApp',[]);
myApp.controller('myCtrl',function($scope,$http){

$http.get('http://apibeta.yourstory.com/v1/site/YOURSTORY/articles').success(function(response){

    $scope.mydata=response;
    //alert(response[0].name);
});
});

</script>
</head>
<body ng-controller="myCtrl">
<table border="1">
    <tr ng-repeat="data in mydata">
        <td>{{data.unique_id}}</td>
        <td>{{data.title}}</td>    
    </tr>

</table>

</body>
</html>

 

It work well with browser.

please help me

Thanks and regards

mohit kumar

View Selected Answer

Responses

3 Replies
Mark as answer
AVSukhov

Hello,

Do you add external resource to access tag in configuration file?

And verify that mydata object not empty.

daniel kim

Hi,

First of all, you need to add below tags into config.xml.

          <access origin="*" subdomains="true"/>

         <tizen:privilege name="http://tizen.org/privilege/internet"/>

I've tested with below code and working on Z3. so I would suggest you to check this code.

//index.html

<!DOCTYPE html>
<html ng-app="myApp">>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <meta name="description" content="Tizen basic template generated by Tizen Web IDE"/>

    <title>Tizen Web IDE - Tizen - Tizen basic Application</title>

    <link rel="stylesheet" type="text/css" href="css/style.css"/>
    <script src="js/main.js"></script>

<script src="js/angular.min.js"></script>
 
<script>
 
    var myApp=angular.module('myApp',[]);
   myApp.controller('myCtrl',function($scope,$http){
    $http.get('http://apibeta.yourstory.com/v1/site/YOURSTORY/articles').success(function(response, status, headers, config){

    $scope.mydata=response;
     //alert(response[0].name);
 });
 });

</script>
 </head>

<body ng-controller="myCtrl">
 <table border="1">
     <tr ng-repeat="data in mydata">
         <td>{{data.unique_id}}</td>
         <td>{{data.title}}</td>
     </tr>

</table>
 
</body> 
</html>

 

Hope this will help you.

 

Seoghyun Kang

Dear mohit kumar,

 

I think that following code snippet will helpful for you.

https://developer.tizen.org/community/code-snippet/web-code-snippet/how-get-weather-information-web-server

This code shows to how get the data from web server and parse it.

 

And please check the following thing.

https://developer.tizen.org/community/code-snippet/web-code-snippet/how-set-config.xml-accessing-external-server-0

 

Please refer it.

Thanks.