Simple example of using FalcorJS with AngularJS v1.x
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

FalcorJS + Angular v1 example

A quick example of using FalcorJS with AngularJS v1.


Install dependencies from both npm and jspm

npm install

Start server

npm start

Open http://localhost:9090

How it works

The key to making FalcorJS work with AngularJS is getting it slotted nicely into the digest loop so that changes are detected and shown on the view.
Since FalcorJS is making it's own async http calls without $http, we need to let AngularJS know when a change may have occurred.

The usual tool for this job is $scope.$apply(), but we have to be 100% sure that another $scope.$apply() call isn't already in progress or it will thrown an error.
We could use $timeout() to achieve the same thing, but it will always cause a new digest loop to occur, even if there's already one in progress.
A better alternative is to use $scope.$evalAsync() which gives us the best of both worlds.
Since FalcorJS returns Observables, we simply call $scope.$evalAsync() when subscribing to an Observable.