Skip to content

Commit 7fa72a6

Browse files
docs(*): improve ng1 docs
docs(injectables): list all injectable objects feat(injectables): Expose `$uiRouterProvider`, `$uiRouterGlobals`, and `$stateRegistry` injectables
1 parent c8162ee commit 7fa72a6

File tree

7 files changed

+369
-273
lines changed

7 files changed

+369
-273
lines changed

src/directives/stateDirectives.ts

+12-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* These directives are used in templates to create viewports and navigate to states
55
*
6-
* @preferred @module ng1_directives
6+
* @ng1api @preferred @module directives
77
*/ /** for typedoc */
88
import { ng as angular } from "../angular";
99
import { IAugmentedJQuery, ITimeoutService, IScope, IInterpolateService } from "angular";
@@ -14,6 +14,9 @@ import {
1414
} from "ui-router-core";
1515
import { UIViewData } from "./viewDirective";
1616

17+
/** @hidden Used for typedoc */
18+
export interface ng1_directive {}
19+
1720
/** @hidden */
1821
function parseStateRef(ref: string) {
1922
let paramsOnly = ref.match(/^\s*({[^}]*})\s*$/), parsed;
@@ -211,7 +214,8 @@ function defaultOpts(el: IAugmentedJQuery, $state: StateService) {
211214
* - Unlike the parameter values expression, the state name is not `$watch`ed (for performance reasons).
212215
* If you need to dynamically update the state being linked to, use the fully dynamic [[uiState]] directive.
213216
*/
214-
let uiSref = ['$uiRouter', '$timeout',
217+
let uiSref: ng1_directive;
218+
uiSref = ['$uiRouter', '$timeout',
215219
function $StateRefDirective($uiRouter: UIRouter, $timeout: ITimeoutService) {
216220
let $state = $uiRouter.stateService;
217221

@@ -334,7 +338,8 @@ let uiSref = ['$uiRouter', '$timeout',
334338
* - A middle-click, right-click, or ctrl-click is handled (natively) by the browser to open the href in a new window, for example.
335339
* ```
336340
*/
337-
let uiState = ['$uiRouter', '$timeout',
341+
let uiState: ng1_directive;
342+
uiState = ['$uiRouter', '$timeout',
338343
function $StateRefDynamicDirective($uiRouter: UIRouter, $timeout: ITimeoutService) {
339344
let $state = $uiRouter.stateService;
340345

@@ -469,7 +474,8 @@ let uiState = ['$uiRouter', '$timeout',
469474
*
470475
* - Multiple classes may be specified in a space-separated format: `ui-sref-active='class1 class2 class3'`
471476
*/
472-
let uiSrefActive = ['$state', '$stateParams', '$interpolate', '$uiRouter',
477+
let uiSrefActive: ng1_directive;
478+
uiSrefActive = ['$state', '$stateParams', '$interpolate', '$uiRouter',
473479
function $StateRefActiveDirective($state: StateService, $stateParams: Obj, $interpolate: IInterpolateService, $uiRouter: UIRouter) {
474480
return {
475481
restrict: "A",
@@ -564,7 +570,9 @@ let uiSrefActive = ['$state', '$stateParams', '$interpolate', '$uiRouter',
564570
};
565571
}];
566572

573+
/** @hidden */
567574
interface Def { uiState: string; href: string; uiStateParams: Obj; uiStateOpts: any; }
575+
/** @hidden */
568576
interface StateData { state: StateDeclaration; params: RawParams; activeClass: string; }
569577

570578
angular.module('ui.router.state')

src/directives/viewDirective.ts

+15-11
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/** @module ng1_directives */ /** for typedoc */
1+
/** @ng1api @module directives */ /** for typedoc */
22
import { ng as angular } from "../angular";
33
import {
44
IInterpolateService, IScope, ITranscludeFunction, IAugmentedJQuery,
@@ -13,6 +13,7 @@ import {
1313
import {Ng1ViewConfig} from "../statebuilders/views";
1414
import {Ng1Controller, Ng1StateDeclaration} from "../interface";
1515
import {getLocals} from "../services";
16+
import { ng1_directive } from "./stateDirectives";
1617

1718
/** @hidden */
1819
export type UIViewData = {
@@ -30,18 +31,17 @@ export type UIViewAnimData = {
3031
/**
3132
* `ui-view`: A viewport directive which is filled in by a view from the active state.
3233
*
33-
* @param {string=} name A view name. The name should be unique amongst the other views in the
34-
* same state. You can have views of the same name that live in different states.
34+
* ### Attributes
3535
*
36-
* @param {string=} autoscroll It allows you to set the scroll behavior of the browser window
37-
* when a view is populated. By default, $anchorScroll is overridden by ui-router's custom scroll
38-
* service, {@link ui.router.state.$uiViewScroll}. This custom service let's you
39-
* scroll ui-view elements into view when they are populated during a state activation.
36+
* - `name`: (Optional) A view name.
37+
* The name should be unique amongst the other views in the same state.
38+
* You can have views of the same name that live in different states.
39+
* The ui-view can be targeted in a View using the name ([[Ng1StateDeclaration.views]]).
4040
*
41-
* *Note: To revert back to old [`$anchorScroll`](http://docs.angularjs.org/api/ng.$anchorScroll)
42-
* functionality, call `$uiViewScrollProvider.useAnchorScroll()`.*
41+
* - `autoscroll`: an expression. When it evaluates to true, the `ui-view` will be scrolled into view when it is activated.
42+
* Uses [[$uiViewScroll]] to do the scrolling.
4343
*
44-
* @param {string=} onload Expression to evaluate whenever the view updates.
44+
* - `onload`: Expression to evaluate whenever the view updates.
4545
*
4646
* A view can be unnamed or named.
4747
* @example
@@ -52,6 +52,9 @@ export type UIViewAnimData = {
5252
*
5353
* <!-- Named -->
5454
* <div ui-view="viewName"></div>
55+
*
56+
* <!-- Named (different style) -->
57+
* <ui-view name="viewName"></ui-view>
5558
* ```
5659
*
5760
* You can only have one unnamed view within any template (or root html). If you are only using a
@@ -155,7 +158,8 @@ export type UIViewAnimData = {
155158
* });
156159
* ```
157160
*/
158-
let uiView = ['$view', '$animate', '$uiViewScroll', '$interpolate', '$q',
161+
let uiView: ng1_directive;
162+
uiView = ['$view', '$animate', '$uiViewScroll', '$interpolate', '$q',
159163
function $ViewDirective($view: ViewService, $animate: any, $uiViewScroll: any, $interpolate: IInterpolateService, $q: $QLike) {
160164

161165
function getRenderer(attrs: Obj, scope: IScope) {

src/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export * from "./services";
1111
export * from "./statebuilders/views";
1212
export * from "./stateProvider";
1313

14+
import "./injectables";
1415
import "./directives/stateDirectives";
1516
import "./stateFilters";
1617
import "./directives/viewDirective";

0 commit comments

Comments
 (0)