Links no longer work after being deployed to ios


#1

Loading my app locally all of my routes work fine. When I launch it with xcode directly to my iphone or the emulator my list loads fine but tapping any item does not trigger the detail route.

app.js

angular.module('test', ['ionic', 'test.controllers'])
.run(function ($rootScope, $state, $ionicPlatform, $window) {
	$ionicPlatform.ready(function () {
		if (window.StatusBar) {
			StatusBar.styleDefault();
		}
	});
})
.config(function ($stateProvider, $urlRouterProvider) {
	$stateProvider
		.state('app', {
			url: "/app",
			abstract: true,
			templateUrl: "templates/menu.html",
			controller: "AppCtrl"
		})
		.state('app.list', {
			url: "/list/:location",
			views: {
				'menuContent': {
					templateUrl: "templates/list.html",
					controller: "ListCtrl"
				}
			}
		})
		.state('app.detail', {
			url: "/detail/:detailId",
			views: {
				'menuContent': {
					templateUrl: "templates/details.html",
					controller: "DetailCtrl"
				}
			}
		});

	$urlRouterProvider.otherwise('/app/list/1');
});

controllers.js

var app = angular.module('test.controllers', []);

app.service('Api', ['$http', function Api($http) {

	var url_api = '/api/';

	var asyncGet = function(action) {
		var promise = $http.get(url_api + action).success(function(response) {
			return response;
		});
		return promise;
	};

	var asyncPost = function(action, params) {
		var promise = $http({
			method: 'POST',
			url: url_api + action,
			data: params,
			headers: {
				'Access-Control-Allow-Origin': true,
				'Content-Type': 'application/json'
			}
		}, {cache: true}).success(function(data, status, headers, config) {
			return data;
		});
		return promise;
	};

	// public
	return {
		get: function(action) {
			return asyncGet(action);
		},
		post: function(action, params) {
			return asyncPost(action, params);
		}
	};
}]);

app.controller('AppCtrl', function ($scope, $state) {});

app.controller('ListCtrl', ['$rootScope', '$scope', '$stateParams', 'Api', function ($rootScope, $scope, $stateParams, Api) {
	items = [];

	$rootScope.location = parseInt($stateParams.location, 10) || $rootScope.location;

	Api.get('list').then(function(result) {

		_.each(result.data, function(item) {
			if (item.location === $rootScope.location && item.upnext === $rootScope.upnext) {
				items.push(item);
			}
		});

		$scope.list = items;
	});


}]);

app.controller('DetailCtrl', ['$rootScope', '$scope', '$stateParams', 'Api', function ($rootScope, $scope, $stateParams, Api) {
		items = [];

		Api.get('list').then(function(result) {

			_.each(result.data, function(item) {
				if (item.location === $rootScope.location && item.upnext === $rootScope.upnext) {
					items.push(item);
				}
			});

			var item = _.filter(items, _.matches({_id: $stateParams.detailId}))[0];

			$scope.list = item;
			console.log($scope.list);
		});
	}
]);

list.html

<ion-view title="test">
<ion-nav-buttons side="left">
	<button menu-toggle="left" class="button button-icon icon ion-navicon"></button>
</ion-nav-buttons>
<ion-content class="has-header">
	<ion-list>
		<ion-item ng-repeat="item in list | orderBy:'foo'" href="#/app/detail/{{item._id}}">
			<span class="foobar">{{item.foo}}</span>	{{item.bar}}
		</ion-item>
	</ion-list>
</ion-content>

details.html

<ion-view align-title="left" title="Details">
<ion-content has-header="true">
	Details Page
</ion-content>

#2

Can you see if any error are coming up in your console?

http://moduscreate.com/enable-remote-web-inspector-in-ios-6/

Try one of our sample projects to make sure it works. It could be an error in your code.


#3

I got it figured out. I had somehow included an older version of the framework in my project. Everything is working now.