if want call function in controller when make changes in different controller, use $on
, $broadcast
.
however, i've started using $watch
more recently. now, have variable in service, example this.shouldireload = false
. whenever make change(for example, deleting item in modal), change value in service, , using $watch
, can call reload function in controller. works.
which way better? pros , cons of each?
Comments
Post a Comment