I am currently creating an Android application in Cordova Tools for Visual Studio using Ionic and AngularJS.
My goal is to redirect to another HTML page once my function has completed its execution, but I'm having trouble getting it to work correctly.
Here's the function:
if (id == null || id == undefined) {
contact.save(saveSuccess, saveError);
}
else {
contact.save(upSuccess, upError);
}
function saveSuccess(newContact) {
id = newContact.id;
table.insert({ contactid: id, firstname: name.givenName, lastname: name.familyName, homephone: phoneNumbers[0].value, mobilephone: phoneNumbers[1].value, email: emails[0].value });
alert("Contact Saved.");
window.location("#/managermenu");
}
And here is my $routeProvider code:
droidSync.config(function ($routeProvider) {
$routeProvider
.when('/', {
templateUrl: 'app/pages/main.html',
controller: 'mainController'
})
.when('/addcontact', {
templateUrl: 'app/pages/addcontact.html',
controller: 'managerController'
})
.when('/editcontact', {
templateUrl: 'app/pages/editcontact.html',
controller: 'managerController'
})
.when('/deletecontact', {
templateUrl: 'app/pages/deletecontact.html',
controller: 'managerController'
})
.when('/managermenu', {
templateUrl: 'app/pages/managermenu.html',
controller: 'managermenuController'
})
.when('/settings', {
templateUrl: 'app/pages/settings.html',
controller: 'settingsController'
});
});
I have limited experience with Angular and JS, so I might be overlooking something crucial...