I am working on an electron application whose client side is written in Angular2 .
I had a classic problem that many people have encountered (for example, here and here ), namely that I am updating the data of my components, but the view is not updating because Angular does not know that the data has been changed. The solutions that people offer (see above as well as here ) are to manually trigger change detection either on the entire component tree or in parts (like Angular 1 $rootScope.$digest and $scope.$digest ).
However, I would like to avoid transferring all my data changes to calls to zone.run() , as this spoils the purpose of using Angular a bit.
I am sure I know why this happens: I create Bluebird Promises outside of Angular, in electronic code (i.e. the main process ), and they are not a zone, so they do not notify Angular of changes.
I do not know how to solve this. What can I do to create a Promises aware Zone in my electronic code to avoid having to manually trigger change detection all the time? Can I somehow transform my Bluebird Promises into a Promises aware zone?
EDIT . I think I was wrong, Bluebird Promises do not know the zone, even if they are created inside Angular. They generally do not know the zone as a whole.
EDIT 2 : I was completely wrong in the previous edit. Bluebird Promises works great with zones. However, in the context of an electronic application, creating a promise in the main electronic process and using it in the rendering process (where Angular lives) does not work, because the returned promise is not a zone promise. Making a promise with Angular worked.
source share