# Ionic can not connect to dreamfactory

**URL:** <https://community.dreamfactory.com/t/ionic-can-not-connect-to-dreamfactory/2384>\
**Category:** Miscellaneous\
**Created:** [March 20, 2016, 4:25pm UTC](https://community.dreamfactory.com/t/ionic-can-not-connect-to-dreamfactory/2384 "2016-03-20T16:25:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hl1994](https://avatars.discourse-cdn.com/v4/letter/h/13edae/32.png) [@hl1994](https://community.dreamfactory.com/u/hl1994)\
**Post date:** [March 20, 2016, 4:25pm UTC](https://community.dreamfactory.com/t/ionic-can-not-connect-to-dreamfactory/2384/1 "2016-03-20T16:25:41Z")

</div>

Hello, I have one of my problems is ionic can not connect to dreamfactory. I refer to the example [here](https://github.com/dreamfactorysoftware/angular-sdk). Looking forward to the help from everyone.

**app.js**

```
.angular.module('starter', ['ionic'])
.constant('INSTANCE_URL', 'https://df-cinemavn.enterprise.dreamfactory.com')
.constant('APP_API_KEY', 'ac26a84d1f14e3ab9af61d5498c98fadd75cd62829b5c44100e9bd0d4f3958c')

.run(function($ionicPlatform) {
  $ionicPlatform.ready(function() {
    if(window.cordova && window.cordova.plugins.Keyboard) {
      cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
      cordova.plugins.Keyboard.disableScroll(true);
    }
    if(window.StatusBar) {
      StatusBar.styleDefault();
    }
  });
})

.run(['$cookies', 'APP_API_KEY', '$http', '$rootScope', '$window',
  function ($cookies, APP_API_KEY, $http, $rootScope, $window) {
    $http.defaults.headers.common['X-Dreamfactory-API-Key'] = APP_API_KEY;
    $http.defaults.headers.common['X-DreamFactory-Session-Token'] = $cookies.session_token;
  }
])

.config([
    '$httpProvider',
    function ($httpProvider) {
        $httpProvider.interceptors.push('httpInterceptor');
    }
])

.factory('httpInterceptor', [
    function () {
        return {
            request: function (config) {
                if (config.url.indexOf('/api/v2') > -1) {
                    config.url = INSTANCE_URL + config.url;
                };
                return config;
            }
        }
    }
])

.factory('Contacts', [
    '$resource',
    function ($resource) {
        return $resource('/api/v2/db/_table/contact?include_count=true&limit=15&offset=0&order=last_name+ASC', {
            query: {
                method: 'GET',
                isArray: false
            },
            create: {
                method: 'POST',
            },
            update: {
                method: 'PUT'
            },
            remove: {
                method: 'DELETE'
            }
        });
    }
])

.controller('ContactsCtrl', [
    '$scope', 'Contacts',
    function ($scope, Model) {
        Contacts.query({
        })
        .$promise.then(function (result) {
            $scope.contacts = result.resource
        }, function (error) {
        });
    }
]);

```

**index.html**

```
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
    <title></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="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-cookies.min.js"></script>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular-resource.min.js"></script>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular-route.min.js"></script>
    <script src="cordova.js"></script>
    <script src="js/app.js"></script>
  </head>
  <body ng-app="starter" ng-controller="ContactsCtrl">

    <ion-pane>
      <ion-header-bar class="bar-stable">
        <h1 class="title">Ionic Blank Starter</h1>
      </ion-header-bar>
      <ion-content>
        {{contacts.id[1]}}
      </ion-content>
    </ion-pane>
  </body>
</html>
```

---

<div class="post-metadata">

**Author:** ![formerstaff](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/formerstaff/32/1133_2.png) [@formerstaff](https://community.dreamfactory.com/u/formerstaff)\
**Post date:** [March 23, 2016, 5:41pm UTC](https://community.dreamfactory.com/t/ionic-can-not-connect-to-dreamfactory/2384/2 "2016-03-23T17:41:12Z")

</div>

Is there an error message? I’m not sure I understand what the issue is.
