Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ngOrwell

A simple angular observer for AngularJs 1

Install

You can install this package either with npm or with bower.

npm

npm install ng-orwell

Then add ng-orwell as a dependency for your app:

angular.module('myApp', [require('ng-orwell')]);

bower

bower install ng-orwell

Add a <script> to your index.html:

<script src="/bower_components/ng-orwell/Orwell.js"></script>

Then add ngOrwell as a dependency for your app:

angular.module('myApp', ['ngOrwell']);

Documentation

Orwell is a simple to use observable for AngularJs 1.

Including orwell in angular

myApp.controller('myController', function(Orwell){

}

Creating a observable

Orwell.createObservable(name, content);

Getting an observable

Orwell.getObservable(name);

Updating content on an observable

This will call all your observer callbacks who are observing this observable.

var myContent = {
  something: 'something'
};
var observable = Orwell.getObservable(name);
observable.setContent(myContent);

Deleting an observable

Orwell.deleteObservable(name);

Adding an observer to an observable

var observable = Orwell.getObservable(name);
var observer = observable.addObserver(function(content){
  // your callback code here.
})

Destroying an observer

var observable = Orwell.getObservable(name);
var observer = observable.addObserver(function(content){
  // your callback code here.
})
$scope.$on('destroy', function(){
  observable.removeObserver(observer);
});

License

Apache 2.0

About

A simple angular observer for AngularJs 1

Resources

Stars

5 stars

Watchers

111 watching

Forks

Releases

Packages

Used by

Contributors

Languages