Is it possible to update an AngularJS expression via an API call through a Service? -
i'm looking way (and not sure if possible) update angular expression on html page when data sent api.
for example, have $scope.message on .html page. there way can send message api (e.g. http://...?message=foo) , have page update message sent?
also, need $scope.message updated in angular service available multiple pages within website.
i wanting live update, if not, happy code executing on timer or similar.
any suggestions appreciated.
update
i'm guessing may not possible, in case haven't explained correctly, i'll try , simplify it.
i can find information using angularjs send commands out url , receive data back. need send json string to angular site update variable. field updates in database, want server application send alert angular site update status of value live. don't want run constant check of database if don't have to.
i open other suggestions on how achieve this.
if don't care old school browsers, can try using websocket, similar tcp socket, allows push server client. create service manages websocket connection, , update scope when receiving message. hope help. more info here: https://developer.mozilla.org/en-us/docs/web/api/websockets_api
Comments
Post a Comment