Asp.net web api call in ionic app works in browser but not in android device app when checks android log no error : log part written in the bottom


#1
**index.html**
<!DOCTYPE html>
<html>  <head>
 <meta http-equiv="Content-Security-Policy" content="default-src *; script-src * 'unsafe-inline' 'unsafe-eval' *; style-src  'self' 'unsafe-inline' *">      
    <meta charset="utf-8">     
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
    <title>Product Search Ionic App</title>
    <link href="lib/ionic/css/ionic.css" rel="stylesheet">
    <link href="css/style.css" rel="stylesheet">
<script src="lib/ionic/js/ionic.bundle.js"></script>     
    <script src="cordova.js"></script>
    <script src="js/app.js"></script>
  </head>
  <body ng-app="Product" ng-controller="GetData">
    <ion-pane>
      <ion-header-bar class="bar-stable">
        <h1 class="title">Product Search</h1>         
      </ion-header-bar>
      <ion-content>
<div class="list">
  <label class="item item-input">
    <input type="text" placeholder="Enter Product Name or Keyword to search"
           ng-focus="$route.reload();"
           ng-model="product.entkey" 
           ng-change="fetch(product)" >
  </label>
</div>        
          <!-- Product List -->
          <div ng-show="productlist.length">
          <h4 class="title">Product List</h4>
          <ul>
          <li class="item" ng-repeat="product in productlist" > 
            <a href="details.html#/?ProductId={{product.PID}}"  
               ng-bind-html="trustAsHtml(product.PROD_NAME)"></a>
          </li>
          </ul>
          </div>          
          <div ng-show="!productlist.length">
          <h5 class="title">No Product Found</h4>
          </div>
      </ion-content>
    </ion-pane>
  </body>
</html>

app.js

var app = angular.module('Product', ['ionic']);
app.controller('GetData',function($scope,$http, $sce,$location){
    $scope.show=false;
    $scope.fetch=function(product){
        $scope.show=false;
        console.log('dss');
        console.log(product.entkey);
        if (/\S/.test(product.entkey)) {
    $http.get("/ApiProduct/?keyword=" + product.entkey)
        .success(function(response){
        console.log(response);
        $scope.trustAsHtml = $sce.trustAsHtml;            
        $scope.productlist = response;
         $scope.show=true;
        //$scope.productdetails=true;
         //$scope.productdetails= productdetails();
    }, function (err) {
                  console.error("productdetails error" +err);
                });
        }
        else{$scope.productlist = ''}
    }
})


app.run(function($ionicPlatform) {  
  $ionicPlatform.ready(function() {
    // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
    // for form inputs)
    if(window.cordova && window.cordova.plugins.Keyboard) {
      cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
    }
    if(window.StatusBar) {
      StatusBar.styleDefault();
    }
  });
})

ionic.project

{
  "name": "productest",
  "app_id": ""
  ,
  "proxies" : [
  {
  "path" : "/ApiProduct/",
  "proxyUrl" : "http://192.168.0.100:40/Api/Product/"
  }
  ]
}

Log

I/chromium(17881): [INFO:CONSOLE(25)] "dss", source: file:///android_asset/www/js/app.js (25)

I/chromium(17881): [INFO:CONSOLE(26)] "korto", source: file:///android_asset/www/js/app.js (26)

D/PhoneApp( 1652): getPhone phoneId:0

I/SBar.MotoNetworkCtrlr( 1303): updateDataNetType[1]: phoneId1 is not DDS( =phoneId0 ) ! -- Set all data icons to off ( SubscriptionManager.getPhoneId returned 0=0x00000000 )

I/SBar.MotoNetworkCtrlr( 1303): onReceive: WifiManager.RSSI_CHANGED_ACTION Received

I/SBar.MotoNetworkCtrlr( 1303): updateWifiState: RSSI_CHANGED_ACTION: mWifiConnected=true mWifiLevel=4 mWifiRssi=-36

D/PhoneApp( 1652): getPhone phoneId:0

I/SBar.MotoNetworkCtrlr( 1303): updateDataNetType[1]: phoneId1 is not DDS( =phoneId0 ) ! -- Set all data icons to off ( SubscriptionManager.getPhoneId returned 0=0x00000000 )

V/AlarmManager(  824): send {1a03233b, *walarm*:ALARM_WAKEUP156011953}

V/AlarmManager(  824): done {1a03233b, *walarm*:ALARM_WAKEUP156011953} [5ms]

I/chromium(17881): [INFO:CONSOLE(25)] "dss", source: file:///android_asset/www/js/app.js (25)

I/chromium(17881): [INFO:CONSOLE(26)] "korton", source: file:///android_asset/www/js/app.js (26)

I/SFPerfTracer(  246):      triggers: (rate: 11562:565984) (compose: 0:233) (post: 11:265) (render: 16:6591) (2:1713697 frames) (3:1813810)

D/SFPerfTracer(  246):        layers: (4:16) (FocusedStackFrame (0xb7a3beb8): 0:4387)* (DimLayer (0xb7993c50): 0:45)* (DimLayer (0xb7a2c518): 0:5474)* (DimLayer (0xb7a2de80): 0:1136)* (com.android.systemui.ImageWallpaper (0xb7a1d3a0): 0:17636)* (StatusBar (0xb7a21810): 0:160921) (NavigationBar (0xb7a244a0): 0:94782) (com.ionicframework.productest868526/com.ionicframework.productest868526.MainActivity (0xb7a4d2d0): 1:179) (InputMethod (0xb7a4f3e8): 3:136) (ScreenshotSurface (0xb7a4a078): 0:28)- (BlackSurface (0xb7a560d0): 0:27)- (BlackSurface (0xb79d9c08): 0:27)- (BlackSurface (0xb7a535a0): 0:27)- (BlackSurface (0xb7a45f90): 0:27)- (PopupWindow:34673143 (0xb7a560d0): 0:3)- 

D/AccountTypeManager( 6059): Registering external account type=com.whatsapp, packageName=com.whatsapp

#2

Please learn how to format code in your post, it’s a pain to read


#3

OK I ll take care next time. Thanks for having a look on my post.


#4

I have formatted the html code i.e. index.html.


#5

This is how you format your code.