Can help me?
I’m working with restangular and in browser and iOS emulator working perfect, but in IonicView App not working, does not request.
{
"name": "IonicTest",
"app_id": "",
"proxies": [
{
"path": "/v1",
"proxyUrl": "http://api.site.com/v1"
}
],
"gulpStartupTasks": [
"sass",
"watch"
],
"watchPatterns": [
"www/**/*",
"!www/lib/**/*"
]
}
app.js
angular.module('starter', ['ionic', 'starter.controllers', 'starter.services', 'restangular'])
.constant('ApiEndpoint', {
url: 'v1'
})
.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) {
// org.apache.cordova.statusbar required
StatusBar.styleDefault();
}
});
})
.config(function($stateProvider, $urlRouterProvider, RestangularProvider, ApiEndpoint) {
// Restangular config
RestangularProvider.setBaseUrl(ApiEndpoint.url);
RestangularProvider.setDefaultRequestParams({ app_key: "MyKey" });
RestangularProvider.setFullResponse(true);
$stateProvider
// setup an abstract state for the tabs directive
.state('tab', {
url: "/tab",
abstract: true,
templateUrl: "templates/tabs.html"
})
// Each tab has its own nav history stack:
.state('tab.establishments', {
url: '/establishments',
views: {
'tab-establishments': {
templateUrl: 'templates/tab-establishments.html',
controller: 'EstablishmentsController'
}
}
})
.state('tab.establishment-detail', {
url: '/establishments/:id/:key',
views: {
'tab-establishments': {
templateUrl: 'templates/establishment-detail.html',
controller: 'EstablishmentsDetailController'
}
}
})
// if none of the above states are matched, use this as the fallback
$urlRouterProvider.otherwise('/tab/establishments');
});
controller.js
angular.module('starter.controllers', [])
.controller('EstablishmentsController', function($scope, Establishments) {
$scope.establishments = Establishments.all();
})
.controller('EstablishmentsDetailController', function($scope, $stateParams, Establishments) {
$scope.establishment = Establishments.show($stateParams.id, $stateParams.key);
});
services.js
angular.module('starter.services', [])
.factory('Establishments', function(Restangular) {
return {
all: function() {
return Restangular.all("establishments").getList().$object;
},
show: function(id, key) {
return Restangular.one("establishments", id).get({ establishment_key: key}).$object;
}
};
});
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>
<!-- compiled css output -->
<link href="css/ionic.app.css" rel="stylesheet">
<!-- ionic/angularjs js -->
<script src="lib/ionic/js/ionic.bundle.js"></script>
<!-- dependencies -->
<script src="lib/restangular/dist/restangular.min.js"></script>
<script src="lib/lodash/dist/lodash.min.js"></script>
<script src="lib/lodash/dist/lodash.underscore.min.js"></script>
<!-- cordova script (this will be a 404 during development) -->
<script src="cordova.js"></script>
<!-- your app's js -->
<script src="js/app.js"></script>
<script src="js/controllers.js"></script>
<script src="js/services.js"></script>
</head>
<body ng-app="starter">
<!--
The nav bar that will be updated as we navigate between views.
-->
<ion-nav-bar class="bar-energized">
<ion-nav-back-button>
</ion-nav-back-button>
</ion-nav-bar>
<!--
The views will be rendered in the <ion-nav-view> directive below
Templates are in the /templates folder (but you could also
have templates inline in this html file if you'd like).
-->
<ion-nav-view></ion-nav-view>
</body>
</html>