$scope.$apply in meteor-angular


#1

I’m changing scope values to hide/show divs but doesn’t work if I don’t do $scope.$apply. The problems are 2:

  • How can I do this with meteor-angular?
  • Why I have to apply $scope (or “this” in this case) when I’ve got exactly the same app just in Angular and doesn’t need that apply in that function?

I’ve read this but I’m not sure if I know how to use it properly: https://www.angular-meteor.com/api/1.3.11/apply


#2

Well, so far I’ve tried 2 different ways:

  1. getReactively:
    this.step = 2; this.getReactively('step');

  2. $bindToContext:
    this.step = 2; ChangeStep.update(this.step, this.$bindToContext((err) => { // throws this error: Unhandled promise rejection }));

From this url I’ve read this info:

getReactively: Use this method to get a context variable and watch it reactively, so each change of this variable causes the dependents (autorun, helper functions and subscriptions) to run again.

$bindToContext: This method binds the function to the reactive context. Any change in the function to the reactive context will be updated in the view accordingly.

Any help with this will be really appreciated.

Cheers