Skip to content

Commit

Permalink
Fixed examples
Browse files Browse the repository at this point in the history
  • Loading branch information
svstanev committed Sep 30, 2015
1 parent 94bcce0 commit 691bca1
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,17 @@ container.factory(['dep1', 'dep2', 'dep3', fn]);
#### Invoking a function with dependencies
Dependencies of the function may be resolved by the function's argument names, through the $inject annotation or when invoking the function:
```
di.container()
var result = di.container()
.value('x', 1)
.value('y', 2)
.invoke(function add(x, y) {
return x + y;
})
;
var result = di.container()
.value('x', 1)
.value('y', 2)
.invoke(['x', 'y', function(a, b) {
return a + b;
}])
Expand All @@ -88,7 +93,7 @@ di.container()

#### Invoking a constructor function with dependencies
```
di.container()
var myObject = di.container()
.value('x', 1)
.value('y', 2)
.createInstance(MyObject);
Expand Down

0 comments on commit 691bca1

Please sign in to comment.