Skip to content

Commit d07811b

Browse files
committed
Added installation and usage sections
1 parent c417bfb commit d07811b

File tree

1 file changed

+36
-1
lines changed

1 file changed

+36
-1
lines changed

README.md

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,42 @@ Angular Fibonacci is a tiny AngularJS Service that lets you poll your server usi
99
##Installation
1010
* Download the file manually from GitHub or use [Bower](http://bower.io/):
1111

12-
```bower install fibonacci-angular```
12+
```bower install angular-fibonacci```
1313

1414
* Make sure you add a reference to the Fibonacci service:
1515

16+
```html
17+
<!-- Application Services -->
18+
<script type="text/javascript" src="public/lib/angular-fibonacci/fibonacci.js"></script>
19+
```
20+
21+
* Then load the module:
22+
``` angular.module('angular-fibonacci', []); ```
23+
24+
## Usage
25+
26+
Add the *Fibonacci* dependency to your controller like so:
27+
28+
```javascript
29+
angular.module('myModule').controller('MyController', ['$scope', 'Fibonacci',
30+
function ($scope, Fibonacci) {
31+
...
32+
}]);
33+
```
34+
35+
Then use start polling with a callback, like so:
36+
37+
```javascript
38+
Fibonacci.start({
39+
callback: function() {
40+
// called on 1, 2, 3, 5, 8,... seconds
41+
console.log('polling the server');
42+
}
43+
});
44+
```
45+
### Options
46+
47+
| Property | Description |
48+
| ------------------------|:-------------:|
49+
| max | maximum number of steps into the Fibonacci Series (default: 5) |
50+
| callback (required) | this function gets called whenever a timer ends that is set to one of the elements in the Fibonacci series, so after: 1, 2, 3, 5, 8, ... seconds |

0 commit comments

Comments
 (0)