Skip to content

kristianmandrup/angular-bacon

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

angular-bacon

bacon.js bindings for AngularJS.

Make your AngularJS apps even more reactive, by using bacon.js FRP library to process your scope properties.

Usage

Simply require angular-bacon in your AngularJS module, and both $rootScope and Bacon objects are augmented automatically with the following functions:

$scope.$watchAsProperty(property)

Exposes an AngularJS scope property as a bacon.js property. If the property already has a value in the scope (i.e. is not undefined), that value becomes the property's initial value.

Bacon.Observable.digest($scope, property)

Digests a bacon.js observable (stream or property) back to an AngularJS scope property. Attaches an .onValue handler to the observable, which simply $applies the property in the selected scope with the selected key.

$scope.digestObservables(observables)

Digests multiple bacon.js observables at once. Simple syntactic sugar, when multiple observables are involved. observables is a map with object keys representing $scope property names into which the observables are digested into.

Examples

For examples, see here. This example somewhat mimics raimohanska's awesome bacon.js tutorials: it features a simple login validation form, where a slow backend "is-nickname-taken" check is simulated by a stream with a 5-second delay. In addition, the two selected passwords must match, and be at least five characters long before the submit button is enabled.

About

Angular-bacon.js bindings

Resources

Stars

Watchers

Forks

Packages

No packages published