Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70433

Interface based object initialization

$
0
0

@TiTiTools wrote:

Hi all!

I have this Interface:

export interface UserDataInterfaceFirestore {
    user_name?: string;
    user_email: string;
...
}

… and I have initialized (in a global provider) an object with values.

I want to initialize a new object to populate with new values, but starting the same values the global object.

The problem occurs when I do the following:

private localUserData: UserDataInterfaceFirestore;

this.localUserData = this.global.userData;

I want to modify only this.localUserData, but when I modify an attribute in this.localUserData it automaticaly is updated also in this.global.userData.

Can anybody help me with this? I think is a fundamental misconception from my side, but I don’t know how to solve it.

Thanks!

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70433

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>