How does Angular do global refresh?

now there are some requirements that need to do a global refresh function. Of course, refresh is to update the data of the current routing component. Previously, I wanted to subscribe to events directly in the currently routed component through rxjs, but I found a problem that I could not subscribe to this event.

I am currently using this function point on the outermost layout layout.

box-
    -header
        - refresh()
    -body
        - router
            - components
    -footer
   

{
    path:"",
    component:layoutComponent,
    children:[
        {
            path:"",redirectTo:"/xxx",
        },
        {
            path:"xxx",
            loadChildren:"xxx/xxx.module-sharpxxxModule"
        }
    ]
}

of course, I access this xxx path, but the refresh is performed in the headerComponent (header) in layoutComponent. This action is not intercepted in the subject launch and subscription events using the global rxjs. Ask the master how to deal with this.

Feb.24,2022

make sure it is the same Subject . You should post more relevant code such as Subject declaration, promotion, subscription.


angular6 above can declare that the service of Singleton service, will only be instantiated once. After angular6, you can inject a service into the appmodule for communication between component. This service can no longer be injected into other module, otherwise it will be instantiated multiple times. After multiple instantiations, multiple subject, will fail to achieve the purpose of inter-component communication.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b2b717-2ba87.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b2b717-2ba87.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?