How to implement a simplest service module in ionic

I am new to ionic and I have a problem.
I tried to find a lot of resources online to see the working of service module for sharing data between controllers and hence forth views but haven’t got any that just has basic implementation of a service for sharing data between views.
Supposedly, I have a main.html page which has a input field and a submit button ,now I have another view display.html which just displays whatever is input in text field of first view after submit button is pressed ,How to do this…???
Pls do reply, having this conceptual trouble for a long time

It’s not an ionic question, it’s an angularjs question, there have plenty examples on the web.