i need help.
i have angularjs application. has 2 tabs. first 1 viewing items , second tab adding items. want viewing tab refresh once add need items second tab. know how refresh page
window.location.reload();
but know how can refresh other page when function called. there way refresh html views click?
thank you.
not sure understood, seems have 2 browser tabs (or windows) open , want 1 affect other.
since they're separated, they're running 2 different app instances, meaning stuff scope.$apply()
won't affect other one. basically, need switch "communication across app" "communication across domain". achieve can use localstorage
(or simple cookie, database, file, etc...).
the idea 1 view check session variable (say, every 2 seconds), , force update , clear variable in case variable set.
the other view, of course, in charge of setting variable session once item added.
that's simplest approach.
if want instant changes , constant communication, check out websockets, think might overkill this.
see simple example:
view: http://jsfiddle.net/1dshqpay/
add: http://jsfiddle.net/u7n46lsk/
they 2 separate apps/urls, adding item add show in view.
(i couldn't create here 2 snippets they're sandboxed , not supporting localstorage)