Reactive-Extensions/rx.angular.js

Using with "controller as" style

Closed this issue · 5 comments

Is it possible to use $createObservableFunction('click') without $scope?

Example:

this.$createObservableFunction('click');

Inside a controller that otherwise would not have $scope injected

+1 i'm removing all dependencies on scope in my app at the moment. i'd like to use Rx, i've even used it in a few places but i'd like to know what the plans are before I use all over the place, i have roughly 100 controllers.

also if i can offer my assistance on anything let me know.

You should close this issue.

@xgrommx thank you!

I can't seem to make it work with observeOnScope:

        observeOnScope(this, "$phoneNumber")
          .filter(angular.isDefined)
          .flatMap(number =>
            ApiStore.loadAll("phone_numbers", {
              filter: { number, dont_call: true }
            })
              .filter(pns => pns.length)
              .map(pns => pns[0])
          )
          .do(pn => this.phoneNumber = pn)
          .subscribe(this.$scope.$apply);

Should I use master code?

Edit: this is not supported from what I see at source.
Just use observeOnScope($scope, "vm.$phoneNumber").