Best way of synchronizing objects trough all pages in ionic?How to update the page from the service in ionic2?Initialise all pages/components at startPage not working properly after pushing it in subscribe Firebase.onNotificationOpen Ionic 2page pushed more than once in the navigation stack upon publishing events Ionic 2Ionic 3 - Runtime Error Cannot read property 'scrollToTop' of nullIonic events not working correctly between lazy-loaded modulesIonic 3: Why are events taking so long to respond?ionic-angular - Conflict with using the same component in two pages using the navigation

Which altitudes are safest for VFR?

What should I consider when deciding whether to delay an exam?

Concerning a relationship in the team

A famous scholar sent me an unpublished draft of hers. Then she died. I think her work should be published. What should I do?

Why does it seem the best way to make a living is to invest in real estate?

お仕事に学校頑張って meaning

Is it ok if I haven't decided my research topic when I first meet with a potential phd advisor?

Convert a string of digits from words to an integer

Why, even after his imprisonment, people keep calling Hannibal Lecter "Doctor"?

If a spaceship ran out of fuel somewhere in space between Earth and Mars, does it slowly drift off to the Sun?

Dynamic DataSource for Droplist in Content Editor

An impressive body of work

Calculate the Ultraradical

Can RPi4 run simultaneously on dual band (WiFi 2.4GHz / 5GHz)?

Pushing the e-pawn

Why is STARTTLS still used?

Is population size a parameter, or sample size a statistic?

Why does my browser attempt to download pages from http://clhs.lisp.se instead of viewing them normally?

Top off gas with old oil, is that bad?

What is Weapon Handling?

When did Unix stop storing passwords in clear text?

Windows 10 deletes lots of tiny files super slowly. Anything that can be done to speed it up?

What makes learning more difficult as we age?

How do my husband and I get over our fear of having another difficult baby?



Best way of synchronizing objects trough all pages in ionic?


How to update the page from the service in ionic2?Initialise all pages/components at startPage not working properly after pushing it in subscribe Firebase.onNotificationOpen Ionic 2page pushed more than once in the navigation stack upon publishing events Ionic 2Ionic 3 - Runtime Error Cannot read property 'scrollToTop' of nullIonic events not working correctly between lazy-loaded modulesIonic 3: Why are events taking so long to respond?ionic-angular - Conflict with using the same component in two pages using the navigation






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I have posts to show in the home page of my app which I retrieve them from the server as JSON objects. I have a post class and I create an instance for each post that I got. I put those instances into an array and loop trough them in the home page. But the problem starts when the user updates or adds a post in a different page.



I want to show the updated version of the post or the new post when the user comes back to home page. So far, I was doing it with event subscriptions but it really started to get complicated when you have so many things to update and update can happen in more than 1 page.



Also, the subscription code needs to run before any event happens, and I need to put the subscription code to the related pages so that I can change the view when the event happens. But what about the case when user did not visit the page where I subscribe to an event but made some changes so that the event published. The callback function of the event doesn't work because I wasn't even able to subscribe to it.



So, is there any better way of synchronizing data in all necessary pages in ionic v3?










share|improve this question
























  • sounds like good case for redux and ngrx, have you think about it?

    – Przemyslaw Jan Beigert
    Mar 28 at 20:53











  • Thanks for the advice but I don't think this problem as complicated as I need to use redux or ngrx. Because I don't really need those updates anything else then posts. I am more of a looking for simple ionic or angular native solutions if they have one lol.

    – Akil Demir
    Mar 28 at 22:30

















0















I have posts to show in the home page of my app which I retrieve them from the server as JSON objects. I have a post class and I create an instance for each post that I got. I put those instances into an array and loop trough them in the home page. But the problem starts when the user updates or adds a post in a different page.



I want to show the updated version of the post or the new post when the user comes back to home page. So far, I was doing it with event subscriptions but it really started to get complicated when you have so many things to update and update can happen in more than 1 page.



Also, the subscription code needs to run before any event happens, and I need to put the subscription code to the related pages so that I can change the view when the event happens. But what about the case when user did not visit the page where I subscribe to an event but made some changes so that the event published. The callback function of the event doesn't work because I wasn't even able to subscribe to it.



So, is there any better way of synchronizing data in all necessary pages in ionic v3?










share|improve this question
























  • sounds like good case for redux and ngrx, have you think about it?

    – Przemyslaw Jan Beigert
    Mar 28 at 20:53











  • Thanks for the advice but I don't think this problem as complicated as I need to use redux or ngrx. Because I don't really need those updates anything else then posts. I am more of a looking for simple ionic or angular native solutions if they have one lol.

    – Akil Demir
    Mar 28 at 22:30













0












0








0








I have posts to show in the home page of my app which I retrieve them from the server as JSON objects. I have a post class and I create an instance for each post that I got. I put those instances into an array and loop trough them in the home page. But the problem starts when the user updates or adds a post in a different page.



I want to show the updated version of the post or the new post when the user comes back to home page. So far, I was doing it with event subscriptions but it really started to get complicated when you have so many things to update and update can happen in more than 1 page.



Also, the subscription code needs to run before any event happens, and I need to put the subscription code to the related pages so that I can change the view when the event happens. But what about the case when user did not visit the page where I subscribe to an event but made some changes so that the event published. The callback function of the event doesn't work because I wasn't even able to subscribe to it.



So, is there any better way of synchronizing data in all necessary pages in ionic v3?










share|improve this question














I have posts to show in the home page of my app which I retrieve them from the server as JSON objects. I have a post class and I create an instance for each post that I got. I put those instances into an array and loop trough them in the home page. But the problem starts when the user updates or adds a post in a different page.



I want to show the updated version of the post or the new post when the user comes back to home page. So far, I was doing it with event subscriptions but it really started to get complicated when you have so many things to update and update can happen in more than 1 page.



Also, the subscription code needs to run before any event happens, and I need to put the subscription code to the related pages so that I can change the view when the event happens. But what about the case when user did not visit the page where I subscribe to an event but made some changes so that the event published. The callback function of the event doesn't work because I wasn't even able to subscribe to it.



So, is there any better way of synchronizing data in all necessary pages in ionic v3?







angular typescript ionic3






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 28 at 19:30









Akil DemirAkil Demir

346 bronze badges




346 bronze badges















  • sounds like good case for redux and ngrx, have you think about it?

    – Przemyslaw Jan Beigert
    Mar 28 at 20:53











  • Thanks for the advice but I don't think this problem as complicated as I need to use redux or ngrx. Because I don't really need those updates anything else then posts. I am more of a looking for simple ionic or angular native solutions if they have one lol.

    – Akil Demir
    Mar 28 at 22:30

















  • sounds like good case for redux and ngrx, have you think about it?

    – Przemyslaw Jan Beigert
    Mar 28 at 20:53











  • Thanks for the advice but I don't think this problem as complicated as I need to use redux or ngrx. Because I don't really need those updates anything else then posts. I am more of a looking for simple ionic or angular native solutions if they have one lol.

    – Akil Demir
    Mar 28 at 22:30
















sounds like good case for redux and ngrx, have you think about it?

– Przemyslaw Jan Beigert
Mar 28 at 20:53





sounds like good case for redux and ngrx, have you think about it?

– Przemyslaw Jan Beigert
Mar 28 at 20:53













Thanks for the advice but I don't think this problem as complicated as I need to use redux or ngrx. Because I don't really need those updates anything else then posts. I am more of a looking for simple ionic or angular native solutions if they have one lol.

– Akil Demir
Mar 28 at 22:30





Thanks for the advice but I don't think this problem as complicated as I need to use redux or ngrx. Because I don't really need those updates anything else then posts. I am more of a looking for simple ionic or angular native solutions if they have one lol.

– Akil Demir
Mar 28 at 22:30












1 Answer
1






active

oldest

votes


















0
















If you're looking for something simple i suggest to just wrote statefull service




@injectable()
export class StateService
public stateChange$ = new Subject();
private state: any = ;

public setState(state: any)
this.state = state;
this.stateChange.next(state);





then in component just get state and subscribe to any change of it:



class ComponentX 
constructor(private state: StateService)
this.state = state.state;
this.state.state.subscribe(newState =>
this.state = newState;





It's not very scalable solution, but is fast and you don't have to download any new lib.






share|improve this answer

























  • Thanks I will check it out.

    – Akil Demir
    Mar 29 at 10:26













Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);














draft saved

draft discarded
















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55405526%2fbest-way-of-synchronizing-objects-trough-all-pages-in-ionic%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0
















If you're looking for something simple i suggest to just wrote statefull service




@injectable()
export class StateService
public stateChange$ = new Subject();
private state: any = ;

public setState(state: any)
this.state = state;
this.stateChange.next(state);





then in component just get state and subscribe to any change of it:



class ComponentX 
constructor(private state: StateService)
this.state = state.state;
this.state.state.subscribe(newState =>
this.state = newState;





It's not very scalable solution, but is fast and you don't have to download any new lib.






share|improve this answer

























  • Thanks I will check it out.

    – Akil Demir
    Mar 29 at 10:26















0
















If you're looking for something simple i suggest to just wrote statefull service




@injectable()
export class StateService
public stateChange$ = new Subject();
private state: any = ;

public setState(state: any)
this.state = state;
this.stateChange.next(state);





then in component just get state and subscribe to any change of it:



class ComponentX 
constructor(private state: StateService)
this.state = state.state;
this.state.state.subscribe(newState =>
this.state = newState;





It's not very scalable solution, but is fast and you don't have to download any new lib.






share|improve this answer

























  • Thanks I will check it out.

    – Akil Demir
    Mar 29 at 10:26













0














0










0









If you're looking for something simple i suggest to just wrote statefull service




@injectable()
export class StateService
public stateChange$ = new Subject();
private state: any = ;

public setState(state: any)
this.state = state;
this.stateChange.next(state);





then in component just get state and subscribe to any change of it:



class ComponentX 
constructor(private state: StateService)
this.state = state.state;
this.state.state.subscribe(newState =>
this.state = newState;





It's not very scalable solution, but is fast and you don't have to download any new lib.






share|improve this answer













If you're looking for something simple i suggest to just wrote statefull service




@injectable()
export class StateService
public stateChange$ = new Subject();
private state: any = ;

public setState(state: any)
this.state = state;
this.stateChange.next(state);





then in component just get state and subscribe to any change of it:



class ComponentX 
constructor(private state: StateService)
this.state = state.state;
this.state.state.subscribe(newState =>
this.state = newState;





It's not very scalable solution, but is fast and you don't have to download any new lib.







share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 28 at 22:42









Przemyslaw Jan BeigertPrzemyslaw Jan Beigert

1,1091 gold badge6 silver badges12 bronze badges




1,1091 gold badge6 silver badges12 bronze badges















  • Thanks I will check it out.

    – Akil Demir
    Mar 29 at 10:26

















  • Thanks I will check it out.

    – Akil Demir
    Mar 29 at 10:26
















Thanks I will check it out.

– Akil Demir
Mar 29 at 10:26





Thanks I will check it out.

– Akil Demir
Mar 29 at 10:26




















draft saved

draft discarded















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55405526%2fbest-way-of-synchronizing-objects-trough-all-pages-in-ionic%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현