Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

261
Vistas
update UI with signalR callback

I’m trying to update my UI based off a signalR callback in angluarJs with typescript. I get the callback every time, but I’m getting random results to update the UI. Sometime it works and sometimes it doesn’t without changing code.

Here is my controller constructor that listens to the signalR events:

    var chat = this.$.connection.chatHub;

    chat.client.userListUpdated = (name: any, message: any): void => {

        this.$scope.$apply(() => {
            this.UserList = message; 
        });

    };

    this.$.connection.hub.start().done(() => {        
    });

Like I said I get the callback every time I expect to. It's just this.UserList is bound to the UI and doesn't work every time. It’s inconsistent, it works sometimes and doesn’t other times.

When it works the scope looks like this:

enter image description here

And when it doesn't update scope looks like this:

enter image description here

I noticed when it doesn’t work I get allot more properties in the scope, and the parent is null, watchers is null. But the vm ClassRoomRaciliatorHomeController is the same.

This is hard to figure out cause it happens inconsistency, it works, works, then doesn’t work, then works… ect…

Any insight would be helpful.

I tried doing rootscope.apply() see the same thing. Tried replacing function with () =>() syntax with typescript and see the same thing…

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

I think I was able to get around this by using a broadcast service to publish out the message once it gets received by the signalr handler. Then the broadcast event listener does the this.UserList = … I think this lets the scope use the controller scope instead of dealing with the scope in the signalr event handler.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda