I maintain a set of connection strings (local, dev, stg, prod) and prefer to keep this in a single spot to change only once. During development and testing I have these in a JSON file and use $.getJSON to grab the relevant connection string.
var serviceBase;
$.getJSON("../config.json", function (data) {
serviceBase = data['serviceBase'];
});
This worked fine when testing on local machine but on an emulator or on device I receive an error that it cannot find the file; I presume this is a limitation on jQuery's getJSON not being able to access the iOS file system.
Temporarily I have the connection strings hard coded into my javascript; but how can I store connection strings in my Ionic/Cordova app in a safe manner?
If by "safe" you mean secure, you're going to have a bad time.
Regardless of where you store them, it's always possible to get to them... even if you store them in compiled Objective C code.
As for your issue with not being able to access the file system, that shouldn't be an issue. You are probably having the issue because of your "../" in your URL. Try taking it out so it is just "config.json". Remember that you are using a single page application and javascript runs in the context of the page you are on (index.html).
While we're at it, why JQuery? You could accomplish the same with Angular's $http module.
var serviceBase;
$http.get("config.json").success(function (data) {
serviceBase = data['serviceBase'];
});