This repository has been archived by the owner on Aug 22, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Maksym Butsykin
committed
Aug 12, 2016
1 parent
287f7ba
commit 6673625
Showing
10 changed files
with
97 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
function injectAsProperty(...dependencies) { | ||
return target => { | ||
target.injectAsProperty = target.injectAsProperty || []; | ||
|
||
dependencies.forEach(dependency => { | ||
target.injectAsProperty.push({ | ||
key: dependency, | ||
value: dependency | ||
}); | ||
}); | ||
|
||
return target; | ||
} | ||
} | ||
|
||
export default injectAsProperty; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import {TestService} from '../mock/test.InjectAsProperty'; | ||
|
||
describe('@InjectAsProperty', () => { | ||
|
||
let testService, | ||
$q, | ||
$http; | ||
|
||
beforeEach(angular.mock.inject((_testService_, _$q_, _$http_) => { | ||
testService = _testService_; | ||
$q = _$q_; | ||
$http = _$http_; | ||
})); | ||
|
||
it('injects dependencies', () => { | ||
expect(testService.$q).toEqual($q); | ||
expect(testService.$http).toEqual($http); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import {test} from './test.module'; | ||
import {Module, Service, InjectAsProperty} from './decorators'; | ||
|
||
@Module(test.name) | ||
@Service('testService') | ||
@InjectAsProperty('$q', '$http') | ||
class TestService { | ||
} | ||
|
||
export {TestService}; |
File renamed without changes.