Skip to content

Commit 53c7da8

Browse files
chore(docs): use DOCS.md for documentation idx. Improve docs:
- Use consistent deprecation warnings. - Use consistent #### Example: markup - Fix broken [[foo]] links
1 parent 43efdae commit 53c7da8

12 files changed

+165
-108
lines changed

DOCS.md

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# [UI Router for Angular 1](https://ui-router.github.io/ng1/docs/latest)
2+
3+
#### The de-facto solution to flexible routing in angular 1
4+
5+
<div style="display: flex;">
6+
7+
<iframe style="display: inline-block;" src="https://ghbtns.com/github-btn.html?user=angular-ui&repo=ui-router&type=fork&count=true&size=medium" frameborder="0" scrolling="0" width="110px" height="20px"></iframe>
8+
<iframe style="display: inline-block;" src="https://ghbtns.com/github-btn.html?user=angular-ui&repo=ui-router&type=star&count=true&size=medium" frameborder="0" scrolling="0" width="110px" height="20px"></iframe>
9+
[![Build Status](https://travis-ci.org/angular-ui/ui-router.svg?branch=master)](https://travis-ci.org/angular-ui/ui-router)
10+
11+
</div>
12+
13+
14+
Angular UI-Router is a client-side [Single Page Application](https://en.wikipedia.org/wiki/Single-page_application)
15+
routing framework for [AngularJS](http://angularjs.org).
16+
17+
**[View on Github](http://github.com/angular-ui/ui-router) |**
18+
**[Tutorials](https://ui-router.github.io/ng1/tutorials/)** |
19+
**[Guides](https://ui-router.github.io/guide) |**
20+
**[Sample App](http://ui-router.github.io/resources/sampleapp/) |**
21+
**[Wiki](https://github.com/angular-ui/ui-router/wiki) |**
22+
**[FAQ](https://github.com/angular-ui/ui-router/wiki/Frequently-Asked-Questions)**
23+
24+
#### API Documentation Organization
25+
26+
The documentation is arranged according to API concern, such as `url`, `resolve`, and `core`.
27+
For a list of services and objects that can be injectable, see the [`injectables` section](./injectables.html).
28+
29+
By default, only the public UI-Router API is shown.
30+
To view both public API and the internal APIs, check the "Internal UI-Router API" checkbox.
31+
32+
#### Typescript
33+
34+
UI-Router is written in Typescript.
35+
The API documentation is generated using [TypeDoc](https://github.com/TypeStrong/typedoc).
36+
The documentation reflects the Typescript classes, interfaces, and parameter types information embedded in the source code.
37+
38+
#### Contributing
39+
40+
Angular UI-Router depends on the framework agnostic `ui-router-core`.
41+
To contribute to the documentation, please submit a PR to either
42+
[angular-ui-router](http://github.com/angular-ui/ui-router)
43+
or
44+
[ui-router-core](http://github.com/ui-router/core).
45+
To find where a specific piece of documentation is written, follow the links that say:
46+
> _Defined in ui-router/somedir/somefile.ts_
47+
48+

scripts/docs.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ let replaceInFiles = require('replace-in-file');
66

77
let typedocCmd = [
88
"./node_modules/typedoc/bin/typedoc --tsconfig tsconfig.typedoc.json ",
9-
" --readme README.md ",
9+
" --readme DOCS.md ",
1010
" --name 'angular-ui-router' ",
1111
" --theme node_modules/ui-router-typedoc-themes/bin/default ",
1212
" --out _doc ",

src/directives/stateDirectives.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
/**
2-
* These are the UI-Router angular 1 directives.
2+
* # Angular 1 Directives
33
*
4-
* These directives are used in templates to create viewports and navigate to states
4+
* These are the directives included in UI-Router for Angular 1.
5+
* These directives are used in templates to create viewports and link/navigate to states.
56
*
67
* @ng1api
78
* @preferred
@@ -288,6 +289,7 @@ uiSref = ['$uiRouter', '$timeout',
288289
* <li ng-repeat="link in navlinks">
289290
* <a ui-sref="link.state">{{ link.displayName }}</a>
290291
* </li>
292+
* ```
291293
*
292294
* ### Relative Links
293295
* If the expression evaluates to a relative path, it is processed like [[uiSref]].
@@ -430,7 +432,7 @@ uiState = ['$uiRouter', '$timeout',
430432
* ### Examples
431433
*
432434
* Given the following template:
433-
* @example
435+
* #### Example:
434436
* ```html
435437
* <ul>
436438
* <li ui-sref-active="active" class="item">

src/directives/viewDirective.ts

+9-14
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,9 @@ export type UIViewAnimData = {
4646
*
4747
* - `onload`: Expression to evaluate whenever the view updates.
4848
*
49+
* #### Example:
4950
* A view can be unnamed or named.
50-
* @example
5151
* ```html
52-
*
5352
* <!-- Unnamed -->
5453
* <div ui-view></div>
5554
*
@@ -62,18 +61,18 @@ export type UIViewAnimData = {
6261
*
6362
* You can only have one unnamed view within any template (or root html). If you are only using a
6463
* single view and it is unnamed then you can populate it like so:
65-
* ```
6664
*
65+
* ```html
6766
* <div ui-view></div>
6867
* $stateProvider.state("home", {
6968
* template: "<h1>HELLO!</h1>"
7069
* })
7170
* ```
7271
*
73-
* The above is a convenient shortcut equivalent to specifying your view explicitly with the {@link ui.router.state.$stateProvider#views `views`}
74-
* config property, by name, in this case an empty name:
75-
* ```js
72+
* The above is a convenient shortcut equivalent to specifying your view explicitly with the
73+
* [[Ng1StateDeclaration.views]] config property, by name, in this case an empty name:
7674
*
75+
* ```js
7776
* $stateProvider.state("home", {
7877
* views: {
7978
* "": {
@@ -88,12 +87,10 @@ export type UIViewAnimData = {
8887
* but you could if you wanted, like so:
8988
*
9089
* ```html
91-
*
9290
* <div ui-view="main"></div>
9391
* ```
9492
*
9593
* ```js
96-
*
9794
* $stateProvider.state("home", {
9895
* views: {
9996
* "main": {
@@ -104,8 +101,8 @@ export type UIViewAnimData = {
104101
* ```
105102
*
106103
* Really though, you'll use views to set up multiple views:
107-
* ```html
108104
*
105+
* ```html
109106
* <div ui-view></div>
110107
* <div ui-view="chart"></div>
111108
* <div ui-view="data"></div>
@@ -127,10 +124,8 @@ export type UIViewAnimData = {
127124
* })
128125
* ```
129126
*
130-
* Examples for `autoscroll`:
131-
*
127+
* #### Examples for `autoscroll`:
132128
* ```html
133-
*
134129
* <!-- If autoscroll present with no expression,
135130
* then scroll ui-view into view -->
136131
* <ui-view autoscroll/>
@@ -145,7 +140,7 @@ export type UIViewAnimData = {
145140
* Resolve data:
146141
*
147142
* The resolved data from the state's `resolve` block is placed on the scope as `$resolve` (this
148-
* can be customized using [[ViewDeclaration.resolveAs]]). This can be then accessed from the template.
143+
* can be customized using [[Ng1ViewDeclaration.resolveAs]]). This can be then accessed from the template.
149144
*
150145
* Note that when `controllerAs` is being used, `$resolve` is set on the controller instance *after* the
151146
* controller is instantiated. The `$onInit()` hook can be used to perform initialization code which
@@ -161,7 +156,7 @@ export type UIViewAnimData = {
161156
* });
162157
* ```
163158
*/
164-
let uiView: ng1_directive;
159+
export let uiView: ng1_directive;
165160
uiView = ['$view', '$animate', '$uiViewScroll', '$interpolate', '$q',
166161
function $ViewDirective($view: ViewService, $animate: any, $uiViewScroll: any, $interpolate: IInterpolateService, $q: $QLike) {
167162

src/injectables.ts

+23-13
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ import { UrlRouterProvider } from "./urlRouterProvider";
6868
*
6969
* **Also:** an injectable **Per-Transition Object** object which holds the pending state parameters for the pending `Transition` currently running.
7070
*
71-
* ## Deprecation warning:
71+
* ### Deprecation warning:
7272
*
7373
* The value injected for `$stateParams` is different depending on where it is injected.
7474
*
@@ -77,7 +77,7 @@ import { UrlRouterProvider } from "./urlRouterProvider";
7777
*
7878
* Because of these confusing details, this service is deprecated.
7979
*
80-
* @deprecated Instead of using the global `$stateParams` service object,
80+
* ### Instead of using the global `$stateParams` service object,
8181
* inject [[$uiRouterGlobals]] and use [[UIRouterGlobals.params]]
8282
*
8383
* ```js
@@ -91,7 +91,7 @@ import { UrlRouterProvider } from "./urlRouterProvider";
9191
* }
9292
* ```
9393
*
94-
* @deprecated Instead of using the per-transition `$stateParams` object,
94+
* ### Instead of using the per-transition `$stateParams` object,
9595
* inject the current `Transition` (as [[$transition$]]) and use [[Transition.params]]
9696
*
9797
* ```js
@@ -118,6 +118,7 @@ import { UrlRouterProvider } from "./urlRouterProvider";
118118
* };
119119
* angular.service('SomeService', SomeService);
120120
* ```
121+
* @deprecated
121122
*/
122123
var $stateParams: StateParams;
123124

@@ -279,7 +280,7 @@ var $uiViewScrollProvider: UIViewScrollProvider;
279280
* If you prefer to rely on `$anchorScroll` to scroll the view to the anchor,
280281
* this can be enabled by calling [[UIViewScrollProvider.useAnchorScroll]].
281282
*
282-
* Note: this function is used by the [[uiView]] when the `autoscroll` expression evaluates to true.
283+
* Note: this function is used by the [[directives.uiView]] when the `autoscroll` expression evaluates to true.
283284
*/
284285
var $uiViewScroll: ($element: JQuery) => void;
285286

@@ -305,8 +306,9 @@ var $stateProvider: StateProvider;
305306
* A service used to configure and interact with the URL.
306307
* It has URL related APIs including:
307308
*
308-
* - add URL rules [[UrlService.rules.when]]
309-
* - configure behavior when no url matches [[UrlService.rules.otherwise]]
309+
* - register custom Parameter types `UrlService.config.type` ([[UrlConfigApi.type]])
310+
* - add URL rules: `UrlService.rules.when` ([[UrlRulesApi.when]])
311+
* - configure behavior when no url matches: `UrlService.rules.otherwise` ([[UrlRulesApi.otherwise]])
310312
* - delay initial URL synchronization [[UrlService.deferIntercept]].
311313
* - get or set the current url: [[UrlService.url]]
312314
*
@@ -324,9 +326,9 @@ var $urlServiceProvider: UrlService;
324326
* Used to configure the URL.
325327
* It has URL related APIs including:
326328
*
327-
* - register custom Parameter types [[UrlService.rules.when]]
328-
* - add URL rules [[UrlService.rules.when]]
329-
* - configure behavior when no url matches [[UrlService.rules.otherwise]]
329+
* - register custom Parameter types `UrlService.config.type` ([[UrlConfigApi.type]])
330+
* - add URL rules: `UrlService.rules.when` ([[UrlRulesApi.when]])
331+
* - configure behavior when no url matches: `UrlService.rules.otherwise` ([[UrlRulesApi.otherwise]])
330332
* - delay initial URL synchronization [[UrlService.deferIntercept]].
331333
* - get or set the current url: [[UrlService.url]]
332334
*
@@ -337,48 +339,56 @@ var $urlService: UrlService;
337339
/**
338340
* The URL Router Provider
339341
*
342+
* ### Deprecation warning: This object is now considered internal. Use [[$urlServiceProvider]] instead.
343+
*
340344
* The [[UrlRouter]] singleton as a **Provider Object** (injectable during config time).
341345
*
342346
* #### Note: This object is also exposed as [[$urlRouter]] for injection during runtime.
343347
*
344-
* @deprecated This object is now considered internal. Use [[$urlServiceProvider]] instead.
348+
* @deprecated
345349
*/
346350
var $urlRouterProvider: UrlRouterProvider;
347351

348352
/**
349353
* The Url Router
350354
*
355+
* ### Deprecation warning: This object is now considered internal. Use [[$urlService]] instead.
356+
*
351357
* The [[UrlRouter]] singleton as a **Service Object** (injectable during runtime).
352358
*
353359
* #### Note: This object is also exposed as [[$urlRouterProvider]] for injection during angular config time.
354360
*
355-
* @deprecated This object is now considered internal. Use [[$urlService]] instead.
361+
* @deprecated
356362
*/
357363
var $urlRouter: UrlRouter;
358364

359365
/**
360366
* The URL Matcher Factory
361367
*
368+
* ### Deprecation warning: This object is now considered internal. Use [[$urlService]] instead.
369+
*
362370
* The [[UrlMatcherFactory]] singleton as a **Service Object** (injectable during runtime).
363371
*
364372
* This service is used to set url mapping options, define custom parameter types, and create [[UrlMatcher]] objects.
365373
*
366374
* #### Note: This object is also exposed as [[$urlMatcherFactoryProvider]] for injection during angular config time.
367375
*
368-
* @deprecated This object is now considered internal. Use [[$urlService]] instead.
376+
* @deprecated
369377
*/
370378
var $urlMatcherFactory: UrlMatcherFactory;
371379

372380
/**
373381
* The URL Matcher Factory
374382
*
383+
* ### Deprecation warning: This object is now considered internal. Use [[$urlService]] instead.
384+
*
375385
* The [[UrlMatcherFactory]] singleton as a **Provider Object** (injectable during config time).
376386
*
377387
* This service is used to set url mapping options, define custom parameter types, and create [[UrlMatcher]] objects.
378388
*
379389
* #### Note: This object is also exposed as [[$urlMatcherFactory]] for injection during runtime.
380390
*
381-
* @deprecated This object is now considered internal. Use [[$urlService]] instead.
391+
* @deprecated
382392
*/
383393
var $urlMatcherFactoryProvider: UrlMatcherFactory;
384394

src/interface.ts

+9-10
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,8 @@ export interface Ng1StateDeclaration extends StateDeclaration, Ng1ViewDeclaratio
163163
*
164164
* You can anchor the `ui-view` name to a specific state by including an `@`
165165
*
166-
* @example
167-
*
166+
* #### Example:
168167
* ```js
169-
*
170168
* // target the `<div ui-view='foo'></div>` which was created in a
171169
* // view owned by the state `bar.baz`
172170
* views: { 'foo@bar.baz': {...} }
@@ -270,7 +268,9 @@ export interface Ng1StateDeclaration extends StateDeclaration, Ng1ViewDeclaratio
270268
/**
271269
* Makes all search/query parameters `dynamic`
272270
*
273-
* @deprecated use [[ParamDeclaration.dynamic]]
271+
* ### Deprecation warning: use [[ParamDeclaration.dynamic]] instead
272+
*
273+
* @deprecated
274274
*/
275275
reloadOnSearch?: boolean;
276276
}
@@ -400,7 +400,7 @@ export interface Ng1ViewDeclaration extends _ViewDeclaration {
400400
* A property of [[Ng1StateDeclaration]] or [[Ng1ViewDeclaration]]:
401401
*
402402
* The controller function, or the name of a registered controller. The controller function will be used
403-
* to control the contents of the [[ui-view]] directive.
403+
* to control the contents of the [[directives.uiView]] directive.
404404
*
405405
* If specified as a string, controllerAs can be declared here, i.e., "FooController as foo" instead of in
406406
* a separate [[controllerAs]] property.
@@ -463,7 +463,7 @@ export interface Ng1ViewDeclaration extends _ViewDeclaration {
463463
* A property of [[Ng1StateDeclaration]] or [[Ng1ViewDeclaration]]:
464464
*
465465
* HTML template as a string, or a function which returns an html template as a string.
466-
* This template will be used to render the corresponding [[ui-view]] directive.
466+
* This template will be used to render the corresponding [[directives.uiView]] directive.
467467
*
468468
* This property takes precedence over templateUrl.
469469
*
@@ -489,7 +489,7 @@ export interface Ng1ViewDeclaration extends _ViewDeclaration {
489489
* A property of [[Ng1StateDeclaration]] or [[Ng1ViewDeclaration]]:
490490
*
491491
* A path or a function that returns a path to an html template.
492-
* The template will be fetched and used to render the corresponding [[ui-view]] directive.
492+
* The template will be fetched and used to render the corresponding [[directives.uiView]] directive.
493493
*
494494
* If `templateUrl` is a function, it will be called with the Transition parameters as the first argument.
495495
*
@@ -513,7 +513,7 @@ export interface Ng1ViewDeclaration extends _ViewDeclaration {
513513
* A property of [[Ng1StateDeclaration]] or [[Ng1ViewDeclaration]]:
514514
*
515515
* Injected function which returns the HTML template.
516-
* The template will be used to render the corresponding [[ui-view]] directive.
516+
* The template will be used to render the corresponding [[directives.uiView]] directive.
517517
*
518518
* #### Example:
519519
* ```js
@@ -558,9 +558,8 @@ export interface Ng1Controller {
558558
* @param newValues an object containing the changed parameter values
559559
* @param $transition$ the new Transition which triggered this callback
560560
*
561-
* @example:
561+
* #### Example:
562562
* ```js
563-
*
564563
* angular.module('foo').controller('FancyCtrl', function() {
565564
* this.uiOnParamsChanged = function(newParams) {
566565
* console.log("new params: ", newParams);

src/legacy/resolveService.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ var $resolve = {
3838
* // { id: 456, barData: 'bar data' }
3939
* ```
4040
*
41-
* @param invocables an object which looks like an [[StateDefinition.resolve]] object; keys are resolve names and values are injectable functions
41+
* @param invocables an object which looks like an [[StateDeclaration.resolve]] object; keys are resolve names and values are injectable functions
4242
* @param locals key/value pre-resolved data (locals)
4343
* @param parent a promise for a "parent resolve"
4444
*/

0 commit comments

Comments
 (0)