Skip to content

Commit 9d85cbe

Browse files
committed
chore(core): introduce $$body service
This patch makes it easier to gain access to document.body via the injector.
1 parent 4cef752 commit 9d85cbe

File tree

4 files changed

+17
-0
lines changed

4 files changed

+17
-0
lines changed

angularFiles.js

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ var angularFiles = {
1515
'src/ng/anchorScroll.js',
1616
'src/ng/animate.js',
1717
'src/ng/asyncCallback.js',
18+
'src/ng/body.js',
1819
'src/ng/browser.js',
1920
'src/ng/cacheFactory.js',
2021
'src/ng/compile.js',

src/AngularPublic.js

+2
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
$AnimateProvider,
6060
$$CoreAnimateQueueProvider,
6161
$$CoreAnimateRunnerProvider,
62+
$$BodyProvider,
6263
$BrowserProvider,
6364
$CacheFactoryProvider,
6465
$ControllerProvider,
@@ -220,6 +221,7 @@ function publishExternalAPI(angular) {
220221
$animate: $AnimateProvider,
221222
$$animateQueue: $$CoreAnimateQueueProvider,
222223
$$AnimateRunner: $$CoreAnimateRunnerProvider,
224+
$$body: $$BodyProvider,
223225
$browser: $BrowserProvider,
224226
$cacheFactory: $CacheFactoryProvider,
225227
$controller: $ControllerProvider,

src/ng/body.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
'use strict';
2+
3+
function $$BodyProvider() {
4+
this.$get = ['$document', function($document) {
5+
return jqLite($document[0].body);
6+
}];
7+
}

test/ng/bodySpec.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
'use strict';
2+
3+
describe('$$body', function() {
4+
it("should inject $document", inject(function($$body, $document) {
5+
expect($$body).toEqual(jqLite($document[0].body));
6+
}));
7+
});

0 commit comments

Comments
 (0)