0

I need to update my view on changing array in my *.component.ts
I use

public getFolders() : void {
    this.webService.getFolders({client_id : this.local.get('clientUser').client_id}).subscribe( this.processSkills.bind(this, this.local.get('clientUser')))
}

processSkills(res: any, myobj): void {
    if(res.status){
        myobj.folders = res.folders;
        this.local.set('clientUser', myobj);
        this.userObj = this.local.get('clientUser');
    }
}

It updates my array i saw in console it update my session value which i saw after pressing F5 but it doesn't update my view

Initially i am assigning my array to variable from my session object.

1 Answer 1

1
import { BehaviorSubject } from 'rxjs';
private messageSource = new BehaviorSubject(this.local.get('clientUser'));
currentMessage = this.messageSource.asObservable();

I resolved it and found a solution to pass our array into session and make the code into our provider which works as observable to my array and then recieve

currentMessage to our receiver function to update on view.

this.webService.currentMessage.subscribe(message => {
    this.userObj = message;
})

will receive updated value and will reflect on view.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.