I have a websocket-based application that has data 'pushed' to the client-side, in the form of a JSON object.
I need the DOM to be automatically updated, with the JSON that I retrieve over the websocket protocol, via AngularJS. I cannot find a simple way to do this, and a change to the websocket retrieval code is not the way to go about it.
This post, although for Socket.io users (which I am not using), involves using a rather large piece of JavaScript that seems too cumbersome to use, while this post suggests attaching the variable to the $window object - which isn't the best way to go about things.
Assuming two things:
- I have a piece of JSON which I need to automatically update the DOM, that is external to AngularJS
- I am trying to avoid a large code requirement to achieve this
How can I achieve what I require?
I'm playing around with my jsfiddle for updating the DOM (tables) when the JSON updates, however the JSON is within the Angular code. My JSON will be outside it.
$apply- have you come across this before?onandemit. You may end up doing the same :)