aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMisko Hevery2011-11-10 21:03:39 -0800
committerMisko Hevery2011-11-14 20:31:18 -0800
commit035c7510763a9742294d51ba55aea0b6dd08ea58 (patch)
tree9f75d9c428f27cafade730c58d44a170c56dd619
parent186a840cd34d3ffed7b351a1827e7736cd8d54c3 (diff)
downloadangular.js-035c7510763a9742294d51ba55aea0b6dd08ea58.tar.bz2
fix(doc) cleanup all dev guide doc link warnings
-rw-r--r--docs/content/guide/dev_guide.bootstrap.manual_bootstrap.ngdoc4
-rw-r--r--docs/content/guide/dev_guide.compiler.directives.creating_directives.ngdoc2
-rw-r--r--docs/content/guide/dev_guide.compiler.extending_compiler.ngdoc2
-rw-r--r--docs/content/guide/dev_guide.compiler.markup.ngdoc2
-rw-r--r--docs/content/guide/dev_guide.compiler.ngdoc2
-rw-r--r--docs/content/guide/dev_guide.compiler.testing_dom_element.ngdoc2
-rw-r--r--docs/content/guide/dev_guide.compiler.understanding_compiler.ngdoc6
-rw-r--r--docs/content/guide/dev_guide.compiler.widgets.creating_widgets.ngdoc4
-rw-r--r--docs/content/guide/dev_guide.compiler.widgets.ngdoc2
-rw-r--r--docs/content/guide/dev_guide.expressions.ngdoc2
-rw-r--r--docs/content/guide/dev_guide.scopes.internals.ngdoc20
-rw-r--r--docs/content/guide/dev_guide.services.$location.ngdoc155
-rw-r--r--docs/content/guide/dev_guide.services.registering_services.ngdoc7
13 files changed, 101 insertions, 109 deletions
diff --git a/docs/content/guide/dev_guide.bootstrap.manual_bootstrap.ngdoc b/docs/content/guide/dev_guide.bootstrap.manual_bootstrap.ngdoc
index 8ff74d91..435f1418 100644
--- a/docs/content/guide/dev_guide.bootstrap.manual_bootstrap.ngdoc
+++ b/docs/content/guide/dev_guide.bootstrap.manual_bootstrap.ngdoc
@@ -31,7 +31,7 @@ This is the sequence that your code should follow if you bootstrap angular on yo
1. After the page is loaded, find the root of the HTML template, which is typically the root of
the document.
-2. Run angular's {@link dev_guide.compiler Angular HTML compiler}, which converts a template into
+2. Call {@link api/angular.bootstrap} to {@link dev_guide.compiler compile} the template into
an executable, bi-directionally bound application.
@@ -43,4 +43,4 @@ an executable, bi-directionally bound application.
## Related API
-{@link api/angular.compile Compiler API}
+{@link api/angular.module.NG.$compile Compiler API}
diff --git a/docs/content/guide/dev_guide.compiler.directives.creating_directives.ngdoc b/docs/content/guide/dev_guide.compiler.directives.creating_directives.ngdoc
index c9384835..18b9d630 100644
--- a/docs/content/guide/dev_guide.compiler.directives.creating_directives.ngdoc
+++ b/docs/content/guide/dev_guide.compiler.directives.creating_directives.ngdoc
@@ -23,7 +23,7 @@ angular.directive('ng:bind', function(expression, compiledElement) {
The angular compiler exposes methods that you may need to use when writing your own widgets and
directives. For example, the `descend()` method lets you control whether the compiler ignores or
processes child elements of the element it is compiling. For information on this and other
-compiler methods, see the {@link api/angular.compile Compiler API doc}.
+compiler methods, see the {@link api/angular.module.NG.$compile Compiler API doc}.
## Related Docs
diff --git a/docs/content/guide/dev_guide.compiler.extending_compiler.ngdoc b/docs/content/guide/dev_guide.compiler.extending_compiler.ngdoc
index 831b2880..49f76b2b 100644
--- a/docs/content/guide/dev_guide.compiler.extending_compiler.ngdoc
+++ b/docs/content/guide/dev_guide.compiler.extending_compiler.ngdoc
@@ -93,4 +93,4 @@ corresponding spans.
## Related API
-* {@link api/angular.compile angular.compile()}
+* {@link api/angular.module.NG.$compile $compile()}
diff --git a/docs/content/guide/dev_guide.compiler.markup.ngdoc b/docs/content/guide/dev_guide.compiler.markup.ngdoc
index ba28f275..ef327a5d 100644
--- a/docs/content/guide/dev_guide.compiler.markup.ngdoc
+++ b/docs/content/guide/dev_guide.compiler.markup.ngdoc
@@ -89,4 +89,4 @@ angular.attrMarkup('extraClass', function(attrValue, attrName, element){
## Related API
-* {@link api/angular.compile Compiler API Reference}
+* {@link api/angular.module.NG.$compile Compiler API Reference}
diff --git a/docs/content/guide/dev_guide.compiler.ngdoc b/docs/content/guide/dev_guide.compiler.ngdoc
index 8f616c1a..cc673751 100644
--- a/docs/content/guide/dev_guide.compiler.ngdoc
+++ b/docs/content/guide/dev_guide.compiler.ngdoc
@@ -23,4 +23,4 @@ All compilation takes place in the web browser; no server is involved.
## Related API
-* {@link api/angular.compile Angular Compiler API}
+* {@link api/angular.module.NG.$compile Angular Compiler API}
diff --git a/docs/content/guide/dev_guide.compiler.testing_dom_element.ngdoc b/docs/content/guide/dev_guide.compiler.testing_dom_element.ngdoc
index ac6421f3..c7032d2f 100644
--- a/docs/content/guide/dev_guide.compiler.testing_dom_element.ngdoc
+++ b/docs/content/guide/dev_guide.compiler.testing_dom_element.ngdoc
@@ -14,4 +14,4 @@
## Related API
-* {@link api/angular.compile angular.compile()}
+* {@link api/angular.module.NG.$compile $compile()}
diff --git a/docs/content/guide/dev_guide.compiler.understanding_compiler.ngdoc b/docs/content/guide/dev_guide.compiler.understanding_compiler.ngdoc
index b76e5379..4200c823 100644
--- a/docs/content/guide/dev_guide.compiler.understanding_compiler.ngdoc
+++ b/docs/content/guide/dev_guide.compiler.understanding_compiler.ngdoc
@@ -20,7 +20,7 @@ dataset]"`), the link function gets called to set up a listener on each element
Note that angular's built-in widgets, directives, and markup have predefined compile and link
functions that you don't need to modify. When you create your own widgets, directives, or markup,
-you must write compile and link functions for them. Refer to the {@link api/angular.compile
+you must write compile and link functions for them. Refer to the {@link api/angular.module.NG.$compile
Compiler API} for details.
When the angular compiler compiles a page, it proceeds through 3 phases: Compile, Create Root
@@ -53,7 +53,7 @@ Note that while the compile function is executed exactly once, the link function
multiple times, for example, once for each iteration in a repeater.
The angular compiler exposes methods that you will need to make use of when writing your own
-widgets and directives. For information on these methods, see the {@link api/angular.compile
+widgets and directives. For information on these methods, see the {@link api/angular.module.NG.$compile
Compiler API doc}.
@@ -65,4 +65,4 @@ Compiler API doc}.
## Related API
-* {@link api/angular.compile angular.compile()}
+* {@link api/angular.module.NG.$compile $compile()}
diff --git a/docs/content/guide/dev_guide.compiler.widgets.creating_widgets.ngdoc b/docs/content/guide/dev_guide.compiler.widgets.creating_widgets.ngdoc
index 838bead4..2c9fbb34 100644
--- a/docs/content/guide/dev_guide.compiler.widgets.creating_widgets.ngdoc
+++ b/docs/content/guide/dev_guide.compiler.widgets.creating_widgets.ngdoc
@@ -80,7 +80,7 @@ angular.widget('my:time', function(compileElement){
The angular compiler exposes methods that you may need to use of when writing your own widgets and
directives. For example, the `descend()` method lets you control whether the compiler ignores or
processes child elements of the element it is compiling. For information on this and other
-compiler methods, see the {@link api/angular.compile Compiler API doc}.
+compiler methods, see the {@link api/angular.module.NG.$compile Compiler API doc}.
## Related Topics
@@ -92,4 +92,4 @@ compiler methods, see the {@link api/angular.compile Compiler API doc}.
## Related API
-* {@link api/angular.compile Compiler API}
+* {@link api/angular.module.NG.$compile Compiler API}
diff --git a/docs/content/guide/dev_guide.compiler.widgets.ngdoc b/docs/content/guide/dev_guide.compiler.widgets.ngdoc
index 542dec8d..c9e95a57 100644
--- a/docs/content/guide/dev_guide.compiler.widgets.ngdoc
+++ b/docs/content/guide/dev_guide.compiler.widgets.ngdoc
@@ -32,4 +32,4 @@ dev_guide.compiler.widgets.creating_widgets Creating Custom Widgets}.
## Related API
-* {@link api/angular.compile Compiler API}
+* {@link api/angular.module.NG.$compile Compiler API}
diff --git a/docs/content/guide/dev_guide.expressions.ngdoc b/docs/content/guide/dev_guide.expressions.ngdoc
index 4867f9d0..3d5d0266 100644
--- a/docs/content/guide/dev_guide.expressions.ngdoc
+++ b/docs/content/guide/dev_guide.expressions.ngdoc
@@ -243,4 +243,4 @@ so that angular developers and developers who use angular can develop in harmony
## Related API
-* {@link api/angular.compile Angular Compiler API}
+* {@link api/angular.module.NG.$compile Angular Compiler API}
diff --git a/docs/content/guide/dev_guide.scopes.internals.ngdoc b/docs/content/guide/dev_guide.scopes.internals.ngdoc
index 1a6acfdd..211a11bc 100644
--- a/docs/content/guide/dev_guide.scopes.internals.ngdoc
+++ b/docs/content/guide/dev_guide.scopes.internals.ngdoc
@@ -23,9 +23,7 @@ available as `this` within the given context. (Note: This api will change before
### Root scope
-Every application has a root scope, which is the ancestor of all other scopes. The root scope is
-responsible for creating the injector which is assigned to the {@link api/angular.module.NG.$rootScope.Scope#$service
-$service} property, and initializing the services.
+Every application has a root scope, which is the ancestor of all other scopes.
### What is scope used for?
@@ -75,7 +73,7 @@ expect(root.name).toEqual('angular');
### Scope life cycle
1. **Creation**
- * You can create the root scope via {@link api/angular.module.NG.$rootScope.Scope angular.module.NG.$rootScope.Scope()}.
+ * The root scope is created by the {@link api/angular.module.NG.$rootScope $rootScope} service.
* To create a child scopes, you should call {@link api/angular.module.NG.$rootScope.Scope#$new parentScope.$new()}.
2. **Watcher registration**
@@ -116,9 +114,6 @@ scopes come into play throughout and get a sense of their interactions.
1. At application compile time, a root scope is created and is attached to the root `<HTML>` DOM
element.
- 1. The root scope creates an {@link api/angular.injector injector} which is assigned to the
-{@link api/angular.module.NG.$rootScope.Scope#$service $service} property of the root scope.
- 2. Any eager {@link api/angular.module.NG.$rootScope.Scope#$service services} are initialized at this point.
2. During the compilation phase, the {@link dev_guide.compiler compiler} matches {@link
api/angular.directive directives} against the DOM template. The directives usually fall into one of
two categories:
@@ -209,9 +204,14 @@ When you find it necessary to inject your own mocks in your tests, use a scope t
service instances, as shown in the following example.
<pre>
-var myLocation = {};
-var scope = angular.module.NG.$rootScope.Scope(angular.module.NG, {$location: myLocation});
-expect(scope.$service('$location')).toEqual(myLocation);
+it('should allow override of providers', inject(
+ function($provide) {
+ $provide.value('$location', {mode:'I am a mock'});
+ },
+ function($location){
+ expect($location.mode).toBe('I am a mock');
+ }
+)};
</pre>
## Related Topics
diff --git a/docs/content/guide/dev_guide.services.$location.ngdoc b/docs/content/guide/dev_guide.services.$location.ngdoc
index b1a3c23a..cdfd5ac2 100644
--- a/docs/content/guide/dev_guide.services.$location.ngdoc
+++ b/docs/content/guide/dev_guide.services.$location.ngdoc
@@ -88,9 +88,8 @@ setter methods that allow you to get or change the current URL in the browser.
## $location service configuration
-To configure the `$location` service, you get a hold of
-{@link angular.module.ng.$locationProvider $locationProvider} service and configure it with these
-methods:
+To configure the `$location` service, retrieve the
+{@link api/angular.module.NG.$locationProvider $locationProvider} and set the parameters as follows:
- **html5Mode(mode)**: {boolean}<br />
`true` - see HTML5 mode<br />
@@ -210,26 +209,27 @@ In this mode, `$location` uses Hashbang URLs in all browsers.
### Example
<pre>
-angular.module.NG('$locationConfig', function() {
- return {
- html5Mode: false,
- hashPrefix: '!'
- };
-});
-
-// open http://host.com/base/index.html#!/a
-$location.absUrl() == 'http://host.com/base/index.html#!/a'
-$location.path() == '/a'
-
-$location.path('/foo')
-$location.absUrl() == 'http://host.com/base/index.html#!/foo'
-
-$location.search() == {}
-$location.search({a: 'b', c: true});
-$location.absUrl() == 'http://host.com/base/index.html#!/foo?a=b&c'
-
-$location.path('/new').search('x=y');
-$location.absUrl() == 'http://host.com/base/index.html#!/new?x=y'
+it('should show example', inject(
+ function($locationProvider) {
+ $locationProvider.html5mode = false;
+ $locationProvider.hashPrefix = '!';
+ },
+ function($location) {
+ // open http://host.com/base/index.html#!/a
+ $location.absUrl() == 'http://host.com/base/index.html#!/a'
+ $location.path() == '/a'
+
+ $location.path('/foo')
+ $location.absUrl() == 'http://host.com/base/index.html#!/foo'
+
+ $location.search() == {}
+ $location.search({a: 'b', c: true});
+ $location.absUrl() == 'http://host.com/base/index.html#!/foo?a=b&c'
+
+ $location.path('/new').search('x=y');
+ $location.absUrl() == 'http://host.com/base/index.html#!/new?x=y'
+ }
+));
</pre>
### Crawling your app
@@ -258,39 +258,40 @@ having to worry about whether the browser displaying your app supports the histo
### Example
<pre>
-angular.module.NG('$locationConfig', function() {
- return {
- html5Mode: true,
- hashPrefix: '!'
- };
-});
-
-// in browser with HTML5 history support:
-// open http://host.com/#!/a -> rewrite to http://host.com/a
-// (replacing the http://host.com/#!/a history record)
-$location.path() == '/a'
-
-$location.path('/foo');
-$location.absUrl() == 'http://host.com/foo'
-
-$location.search() == {}
-$location.search({a: 'b', c: true});
-$location.absUrl() == 'http://host.com/foo?a=b&c'
-
-$location.path('/new').search('x=y');
-$location.url() == 'new?x=y'
-$location.absUrl() == 'http://host.com/new?x=y'
-
-// in browser without html5 history support:
-// open http://host.com/new?x=y -> redirect to http://host.com/#!/new?x=y
-// (again replacing the http://host.com/new?x=y history item)
-$location.path() == '/new'
-$location.search() == {x: 'y'}
-
-$location.path('/foo/bar');
-$location.path() == '/foo/bar'
-$location.url() == '/foo/bar?x=y'
-$location.absUrl() == 'http://host.com/#!/foo/bar?x=y'
+it('should show example', inject(
+ function($locationProvider) {
+ $locationProvider.html5mode = true;
+ $locationProvider.hashPrefix = '!';
+ },
+ function($location) {
+ // in browser with HTML5 history support:
+ // open http://host.com/#!/a -> rewrite to http://host.com/a
+ // (replacing the http://host.com/#!/a history record)
+ $location.path() == '/a'
+
+ $location.path('/foo');
+ $location.absUrl() == 'http://host.com/foo'
+
+ $location.search() == {}
+ $location.search({a: 'b', c: true});
+ $location.absUrl() == 'http://host.com/foo?a=b&c'
+
+ $location.path('/new').search('x=y');
+ $location.url() == 'new?x=y'
+ $location.absUrl() == 'http://host.com/new?x=y'
+
+ // in browser without html5 history support:
+ // open http://host.com/new?x=y -> redirect to http://host.com/#!/new?x=y
+ // (again replacing the http://host.com/new?x=y history item)
+ $location.path() == '/new'
+ $location.search() == {x: 'y'}
+
+ $location.path('/foo/bar');
+ $location.path() == '/foo/bar'
+ $location.url() == '/foo/bar?x=y'
+ $location.absUrl() == 'http://host.com/#!/foo/bar?x=y'
+ }
+));
</pre>
### Fallback for legacy browsers
@@ -364,7 +365,6 @@ redirect to regular / hashbang url, as this conversion happens only during parsi
= on page reload.
In this examples we use `<base href="/base/index.html" />`
-
<doc:example>
<doc:source source="false">
@@ -422,8 +422,7 @@ In this examples we use `<base href="/base/index.html" />`
var browsers = {
html5: new FakeBrowser('http://www.host.com/base/path?a=b#h', '/base/index.html'),
- hashbang: new FakeBrowser('http://www.host.com/base/index.html#!/path?a=b#h',
-'/base/index.html')
+ hashbang: new FakeBrowser('http://www.host.com/base/index.html#!/path?a=b#h', '/base/index.html')
};
function Html5Cntl($location) {
@@ -461,14 +460,14 @@ In this examples we use `<base href="/base/index.html" />`
function initEnv(name) {
var root = angular.element(document.getElementById(name + '-mode'));
- var scope = angular.module.NG.$rootScope.Scope(null, {
- $locationConfig: {html5Mode: true, hashPrefix: '!'},
- $browser: browsers[name],
- $document: root,
- $sniffer: {history: name == 'html5'}
- });
-
- angular.compile(root)(scope).$apply();
+ angular.bootstrap(root, [function($locationProvider, $provide){
+ $locationProvider.html5Mode = true;
+ $locationProvider.hashPrefix = '!';
+
+ $provide.value('$browser', browsers[name]);
+ $provide.value('$document', root);
+ $provide.value('$sniffer', {history: name == 'html5'});
+ }]);
root.bind('click', function(e) {
e.stopPropagation();
});
@@ -515,26 +514,20 @@ When using `$location` service during testing, you are outside of the angular's
api/angular.module.NG.$rootScope.Scope scope} life-cycle. This means it's your responsibility to call `scope.$apply()`.
<pre>
-angular.module.NG('$serviceUnderTest', function($location) {
- // whatever it does...
-};
-
-describe('$serviceUnderTest', function() {
- var scope, $location, $sut;
-
- beforeEach(function() {
- scope = angular.module.NG.$rootScope.Scope();
- $location = scope.$service('$location');
- $sut = scope.$service('$serviceUnderTest');
+describe('serviceUnderTest', function() {
+ beforeEach(inject(function($provide) {
+ $provide.factory('serviceUnderTest', function($location){
+ // whatever it does...
+ });
});
- it('should...', function() {
+ it('should...', inject(function($location, $rootScope, serviceUnderTest) {
$location.path('/new/path');
- scope.$apply();
+ $rootScope.$apply();
// test whatever the service should do...
- });
+ }));
});
</pre>
diff --git a/docs/content/guide/dev_guide.services.registering_services.ngdoc b/docs/content/guide/dev_guide.services.registering_services.ngdoc
index f3f64459..7f04a617 100644
--- a/docs/content/guide/dev_guide.services.registering_services.ngdoc
+++ b/docs/content/guide/dev_guide.services.registering_services.ngdoc
@@ -2,12 +2,11 @@
@name Developer Guide: Angular Services: Registering Angular Services
@description
-To register a service, register a factory function that creates the service with angular's
-Injector. The Injector is exposed as {@link api/angular.module.NG.$rootScope.Scope#$service scope.$service}. The
-following pseudo-code shows a simple service registration:
+To register a service, retrieve the {@link api/angular.module.AUTO.$provide $provide} service and use one of itse
+registration methods for new service declaration. The following pseudo-code shows a simple service registration:
<pre>
-angular.module.NG('service id', function() {
+$provide.factory('service id', function() {
var shinyNewServiceInstance;
//factory function body that constructs shinyNewServiceInstance
return shinyNewServiceInstance;