As a beginner in OOP, I am currently experimenting with Ionic 2, Angular 2, and TypeScript. In my home.html file, I have an input field connected to the username property in home.ts as shown below:
export class HomePage {
public username: string;
public newusername: string;
...
constructor(public users: UserService) {
...
My goal is to create a userService.ts service that will retrieve the username from the input field or home.ts, modify it, and save the result as newusername.
Do I need to create a constructor in the service/provider similar to the one in Homepage, which initializes a new object of Home even though I already created an object of this in home.ts?
Although I imported HomePage in userServices, I am unable to access newusername because I did not instantiate an object of it.