Click here to Skip to main content
15,884,388 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi I want to test my app on a device using ionic view but my database is on another pc running a web service. I want to know if it is possible to connect to that service from ionic view. On my browser (ionic serve) I am struggling with CORS issues would that be the same issue running on ionic view?

JavaScript
Html Code

<ion-view view-title="Dashboard">
    <ion-content class="padding">
        <div class="list card">
            <div class="item item-divider">Recent Updates</div>
            <div class="item item-body">
                <div>
                    <b>sector 3</b>
                </div>
            </div>
        </div>
        <div class="list card">
            <div class="item item-divider">Upcoming</div>
            <div class="item item-body">
                <p>{{Success + " " + Error}}</p>
            </div>
        </div>
    </ion-content>
</ion-view>
JavaScript Code

angular.module('starter.controllers', [])

.controller('DashCtrl', function($scope, $http) {

    $http.get("http//192.168.1.108/TruckService.svc?singleWsdl")
        .success(function(data) {
            $scope.Success = "SUCCESS!";
        })
        .error(function(data) {
            $scope.Error = "ERROR dude!";
        });
})

.controller('ChatsCtrl', function($scope, Chats) {

    $scope.chats = Chats.all();
    $scope.remove = function(chat) {
        Chats.remove(chat);
    };
})

.controller('ChatDetailCtrl', function($scope, $stateParams, Chats) {
    $scope.chat = Chats.get($stateParams.chatId);
})

.controller('AccountCtrl', function($scope) {
    $scope.settings = {
        enableFriends: true
    };
});
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900