Hey,
Honestly, I’ve never used ngResource in my life. Never had a need as I found $http to be perfect for my needs. So I can’t really help you out there.
But as far as changing it to include the .then function, that is correct. Do you understand why and what the .then method is for? If not, I can elaborate on it and give you a good article on it. I find promises incredibly useful. They are one of my favorite things in web development, no joke. So make sure you know why/where to use them.
Now for you second comment.
You are correct about where the logic goes. If you want to perform an action once the request is successful, put it in the .then. I forgot to mention that you should also check the status code of your response and make sure its the one you wanted. There can be times a .then would run even though the request doesn’t succeed. Its not often, but still best to be sure.
As far as refreshing the page, may I ask why you would like to do so? Really there is no need. With Angular/Ionic, you can simply update the view without refreshing the entire page.
For example, in one app, I have a chat room view that lists all of your chat rooms. You can click a button called “Add New Chat” which makes a request, returns a promise and when that request comes back successful, I just add the new chatRoom to the chatrooms array and the user sees this. No refresh required.
In regards to a success notification, you have a lot of options. I would recommend chechking out
or
http://ngcordova.com/docs/plugins/toast/
Basically what these will do is display a message to the user that doesn’t require a user action (it can if you want though). These are used throughout apps to say things like “Logged in” or “Profile Saved”, and I think should work in your case.
Does all of that make sense? If not, let me know, I’m more than happy to help.
EDIT
I just noticed that you are defining a variable for the promise. Really, there is no need to do that, and I would avoid creating unnecessary variables. If your Service save function returns a promise, you can just use the .then .catch methods on that, without assigning them to something else. Unless thats what you want/need.