@angular-wave/angular.ts 0.0.60 → 0.0.62
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/angular-ts.esm.js +2 -2
- package/dist/angular-ts.umd.js +2 -2
- package/package.json +2 -1
- package/src/angular.spec.js +2 -2
- package/src/core/parser/parse.js +14 -0
- package/src/core/parser/parse.spec.js +7 -5
- package/src/core/parser/parser.js +1 -1
- package/src/core/q/q.js +46 -289
- package/src/core/q/q.md +229 -0
- package/src/core/sanitize/sanitize-uri.js +2 -3
- package/src/core/scope/scope.js +18 -8
- package/src/directive/if/if.js +6 -1
- package/src/filters/limit-to.js +5 -2
- package/src/filters/order-by.js +1 -2
- package/src/index.js +1 -1
- package/src/loader.js +1 -55
- package/src/router/params/param-type.js +2 -1
- package/src/router/state/views.js +3 -0
- package/src/router/state-provider.js +1 -1
- package/src/router/transition/reject-factory.js +1 -0
- package/src/router/url/url-rule.js +1 -1
- package/src/router/url/url-service.js +4 -4
- package/src/router/url/url-service.spec.js +4 -3
- package/src/services/http/http.js +7 -5
- package/src/services/template-request.js +2 -7
- package/src/shared/common.js +1 -1
- package/src/shared/utils.js +2 -11
- package/src/types.js +9 -1
- package/types/core/parser/parse.d.ts +3 -4
- package/types/core/parser/parser.d.ts +1 -1
- package/types/core/q/q.d.ts +2 -2
- package/types/core/sanitize/sanitize-uri.d.ts +4 -5
- package/types/core/scope/scope.d.ts +19 -7
- package/types/index.d.ts +5 -1
- package/types/loader.d.ts +0 -52
- package/types/router/params/param-type.d.ts +2 -1
- package/types/router/state/views.d.ts +2 -0
- package/types/router/state-provider.d.ts +1 -1
- package/types/router/transition/reject-factory.d.ts +1 -0
- package/types/router/url/url-rule.d.ts +0 -1
- package/types/router/url/url-service.d.ts +7 -7
- package/types/services/template-request.d.ts +4 -9
- package/types/shared/utils.d.ts +1 -7
- package/types/types.d.ts +6 -1
- package/types-back/README.md +0 -2
- package/types-back/angular.d.ts +0 -146
- package/types-back/index.d.ts +0 -2126
- package/types-back/jqlite.d.ts +0 -374
- package/types-back/router/core/common/common.d.ts +0 -416
- package/types-back/router/core/common/coreservices.d.ts +0 -77
- package/types-back/router/core/common/glob.d.ts +0 -60
- package/types-back/router/core/common/hof.d.ts +0 -168
- package/types-back/router/core/common/index.d.ts +0 -8
- package/types-back/router/core/common/predicates.d.ts +0 -25
- package/types-back/router/core/common/queue.d.ts +0 -15
- package/types-back/router/core/common/safeConsole.d.ts +0 -5
- package/types-back/router/core/common/strings.d.ts +0 -66
- package/types-back/router/core/common/trace.d.ts +0 -126
- package/types-back/router/core/globals.d.ts +0 -43
- package/types-back/router/core/hooks/coreResolvables.d.ts +0 -6
- package/types-back/router/core/hooks/ignoredTransition.d.ts +0 -4
- package/types-back/router/core/hooks/invalidTransition.d.ts +0 -4
- package/types-back/router/core/hooks/lazyLoad.d.ts +0 -17
- package/types-back/router/core/hooks/onEnterExitRetain.d.ts +0 -10
- package/types-back/router/core/hooks/redirectTo.d.ts +0 -4
- package/types-back/router/core/hooks/resolve.d.ts +0 -11
- package/types-back/router/core/hooks/updateGlobals.d.ts +0 -4
- package/types-back/router/core/hooks/url.d.ts +0 -4
- package/types-back/router/core/hooks/views.d.ts +0 -7
- package/types-back/router/core/index.d.ts +0 -11
- package/types-back/router/core/interface.d.ts +0 -91
- package/types-back/router/core/params/index.d.ts +0 -12
- package/types-back/router/core/params/interface.d.ts +0 -606
- package/types-back/router/core/params/param.d.ts +0 -77
- package/types-back/router/core/params/paramType.d.ts +0 -65
- package/types-back/router/core/params/paramTypes.d.ts +0 -193
- package/types-back/router/core/params/stateParams.d.ts +0 -15
- package/types-back/router/core/path/index.d.ts +0 -2
- package/types-back/router/core/path/pathNode.d.ts +0 -60
- package/types-back/router/core/path/pathUtils.d.ts +0 -105
- package/types-back/router/core/resolve/index.d.ts +0 -3
- package/types-back/router/core/resolve/interface.d.ts +0 -210
- package/types-back/router/core/resolve/resolvable.d.ts +0 -75
- package/types-back/router/core/resolve/resolveContext.d.ts +0 -97
- package/types-back/router/core/router.d.ts +0 -57
- package/types-back/router/core/state/index.d.ts +0 -28
- package/types-back/router/core/state/interface.d.ts +0 -732
- package/types-back/router/core/state/stateBuilder.d.ts +0 -107
- package/types-back/router/core/state/stateMatcher.d.ts +0 -13
- package/types-back/router/core/state/stateObject.d.ts +0 -170
- package/types-back/router/core/state/stateQueueManager.d.ts +0 -27
- package/types-back/router/core/state/stateRegistry.d.ts +0 -138
- package/types-back/router/core/state/stateService.d.ts +0 -386
- package/types-back/router/core/state/targetState.d.ts +0 -105
- package/types-back/router/core/transition/hookBuilder.d.ts +0 -49
- package/types-back/router/core/transition/hookRegistry.d.ts +0 -115
- package/types-back/router/core/transition/index.d.ts +0 -20
- package/types-back/router/core/transition/interface.d.ts +0 -862
- package/types-back/router/core/transition/rejectFactory.d.ts +0 -103
- package/types-back/router/core/transition/transition.d.ts +0 -575
- package/types-back/router/core/transition/transitionEventType.d.ts +0 -26
- package/types-back/router/core/transition/transitionHook.d.ts +0 -96
- package/types-back/router/core/transition/transitionService.d.ts +0 -253
- package/types-back/router/core/url/index.d.ts +0 -8
- package/types-back/router/core/url/interface.d.ts +0 -169
- package/types-back/router/core/url/urlConfig.d.ts +0 -144
- package/types-back/router/core/url/urlMatcher.d.ts +0 -185
- package/types-back/router/core/url/urlMatcherFactory.d.ts +0 -56
- package/types-back/router/core/url/urlRouter.d.ts +0 -101
- package/types-back/router/core/url/urlRule.d.ts +0 -143
- package/types-back/router/core/url/urlRules.d.ts +0 -251
- package/types-back/router/core/url/urlService.d.ts +0 -205
- package/types-back/router/core/view/index.d.ts +0 -2
- package/types-back/router/core/view/interface.d.ts +0 -46
- package/types-back/router/core/view/view.d.ts +0 -176
- package/types-back/router/directives/viewDirective.d.ts +0 -144
- package/types-back/router/index.d.ts +0 -17
- package/types-back/router/interface.d.ts +0 -500
- package/types-back/router/legacy/resolveService.d.ts +0 -47
- package/types-back/router/legacy/stateEvents.d.ts +0 -124
- package/types-back/router/services.d.ts +0 -15
- package/types-back/router/stateFilters.d.ts +0 -10
- package/types-back/router/stateProvider.d.ts +0 -258
- package/types-back/router/statebuilders/onEnterExitRetain.d.ts +0 -13
- package/types-back/router/statebuilders/views.d.ts +0 -53
- package/types-back/router/templateFactory.d.ts +0 -104
- package/types-back/router/viewScroll.d.ts +0 -9
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
/** @publicapi @module directives */ /** */
|
|
2
|
-
import { IDirective } from "../..";
|
|
3
|
-
import { ActiveNGView } from "../core";
|
|
4
|
-
import { Ng1ViewConfig } from "../statebuilders/views";
|
|
5
|
-
|
|
6
|
-
/** @hidden */
|
|
7
|
-
export declare type NGViewData = {
|
|
8
|
-
$cfg: Ng1ViewConfig;
|
|
9
|
-
$ngView: ActiveNGView;
|
|
10
|
-
};
|
|
11
|
-
/** @hidden */
|
|
12
|
-
export declare type NGViewAnimData = {
|
|
13
|
-
$animEnter: Promise<any>;
|
|
14
|
-
$animLeave: Promise<any>;
|
|
15
|
-
$$animLeave: {
|
|
16
|
-
resolve: () => any;
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* `ui-view`: A viewport directive which is filled in by a view from the active state.
|
|
21
|
-
*
|
|
22
|
-
* ### Attributes
|
|
23
|
-
*
|
|
24
|
-
* - `name`: (Optional) A view name.
|
|
25
|
-
* The name should be unique amongst the other views in the same state.
|
|
26
|
-
* You can have views of the same name that live in different states.
|
|
27
|
-
* The ui-view can be targeted in a View using the name ([[Ng1StateDeclaration.views]]).
|
|
28
|
-
*
|
|
29
|
-
* - `autoscroll`: an expression. When it evaluates to true, the `ui-view` will be scrolled into view when it is activated.
|
|
30
|
-
* Uses [[$ngViewScroll]] to do the scrolling.
|
|
31
|
-
*
|
|
32
|
-
* - `onload`: Expression to evaluate whenever the view updates.
|
|
33
|
-
*
|
|
34
|
-
* #### Example:
|
|
35
|
-
* A view can be unnamed or named.
|
|
36
|
-
* ```html
|
|
37
|
-
* <!-- Unnamed -->
|
|
38
|
-
* <div ui-view></div>
|
|
39
|
-
*
|
|
40
|
-
* <!-- Named -->
|
|
41
|
-
* <div ui-view="viewName"></div>
|
|
42
|
-
*
|
|
43
|
-
* <!-- Named (different style) -->
|
|
44
|
-
* <ui-view name="viewName"></ui-view>
|
|
45
|
-
* ```
|
|
46
|
-
*
|
|
47
|
-
* You can only have one unnamed view within any template (or root html). If you are only using a
|
|
48
|
-
* single view and it is unnamed then you can populate it like so:
|
|
49
|
-
*
|
|
50
|
-
* ```html
|
|
51
|
-
* <div ui-view></div>
|
|
52
|
-
* $stateProvider.state("home", {
|
|
53
|
-
* template: "<h1>HELLO!</h1>"
|
|
54
|
-
* })
|
|
55
|
-
* ```
|
|
56
|
-
*
|
|
57
|
-
* The above is a convenient shortcut equivalent to specifying your view explicitly with the
|
|
58
|
-
* [[Ng1StateDeclaration.views]] config property, by name, in this case an empty name:
|
|
59
|
-
*
|
|
60
|
-
* ```js
|
|
61
|
-
* $stateProvider.state("home", {
|
|
62
|
-
* views: {
|
|
63
|
-
* "": {
|
|
64
|
-
* template: "<h1>HELLO!</h1>"
|
|
65
|
-
* }
|
|
66
|
-
* }
|
|
67
|
-
* })
|
|
68
|
-
* ```
|
|
69
|
-
*
|
|
70
|
-
* But typically you'll only use the views property if you name your view or have more than one view
|
|
71
|
-
* in the same template. There's not really a compelling reason to name a view if its the only one,
|
|
72
|
-
* but you could if you wanted, like so:
|
|
73
|
-
*
|
|
74
|
-
* ```html
|
|
75
|
-
* <div ui-view="main"></div>
|
|
76
|
-
* ```
|
|
77
|
-
*
|
|
78
|
-
* ```js
|
|
79
|
-
* $stateProvider.state("home", {
|
|
80
|
-
* views: {
|
|
81
|
-
* "main": {
|
|
82
|
-
* template: "<h1>HELLO!</h1>"
|
|
83
|
-
* }
|
|
84
|
-
* }
|
|
85
|
-
* })
|
|
86
|
-
* ```
|
|
87
|
-
*
|
|
88
|
-
* Really though, you'll use views to set up multiple views:
|
|
89
|
-
*
|
|
90
|
-
* ```html
|
|
91
|
-
* <div ui-view></div>
|
|
92
|
-
* <div ui-view="chart"></div>
|
|
93
|
-
* <div ui-view="data"></div>
|
|
94
|
-
* ```
|
|
95
|
-
*
|
|
96
|
-
* ```js
|
|
97
|
-
* $stateProvider.state("home", {
|
|
98
|
-
* views: {
|
|
99
|
-
* "": {
|
|
100
|
-
* template: "<h1>HELLO!</h1>"
|
|
101
|
-
* },
|
|
102
|
-
* "chart": {
|
|
103
|
-
* template: "<chart_thing/>"
|
|
104
|
-
* },
|
|
105
|
-
* "data": {
|
|
106
|
-
* template: "<data_thing/>"
|
|
107
|
-
* }
|
|
108
|
-
* }
|
|
109
|
-
* })
|
|
110
|
-
* ```
|
|
111
|
-
*
|
|
112
|
-
* #### Examples for `autoscroll`:
|
|
113
|
-
* ```html
|
|
114
|
-
* <!-- If autoscroll present with no expression,
|
|
115
|
-
* then scroll ui-view into view -->
|
|
116
|
-
* <ui-view autoscroll/>
|
|
117
|
-
*
|
|
118
|
-
* <!-- If autoscroll present with valid expression,
|
|
119
|
-
* then scroll ui-view into view if expression evaluates to true -->
|
|
120
|
-
* <ui-view autoscroll='true'/>
|
|
121
|
-
* <ui-view autoscroll='false'/>
|
|
122
|
-
* <ui-view autoscroll='scopeVariable'/>
|
|
123
|
-
* ```
|
|
124
|
-
*
|
|
125
|
-
* Resolve data:
|
|
126
|
-
*
|
|
127
|
-
* The resolved data from the state's `resolve` block is placed on the scope as `$resolve` (this
|
|
128
|
-
* can be customized using [[Ng1ViewDeclaration.resolveAs]]). This can be then accessed from the template.
|
|
129
|
-
*
|
|
130
|
-
* Note that when `controllerAs` is being used, `$resolve` is set on the controller instance *after* the
|
|
131
|
-
* controller is instantiated. The `$onInit()` hook can be used to perform initialization code which
|
|
132
|
-
* depends on `$resolve` data.
|
|
133
|
-
*
|
|
134
|
-
* #### Example:
|
|
135
|
-
* ```js
|
|
136
|
-
* $stateProvider.state('home', {
|
|
137
|
-
* template: '<my-component user="$resolve.user"></my-component>',
|
|
138
|
-
* resolve: {
|
|
139
|
-
* user: function(UserService) { return UserService.fetchUser(); }
|
|
140
|
-
* }
|
|
141
|
-
* });
|
|
142
|
-
* ```
|
|
143
|
-
*/
|
|
144
|
-
export declare let ngView: IDirective;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Main entry point for angular 1.x build
|
|
3
|
-
*/ /** */
|
|
4
|
-
export * from "./interface";
|
|
5
|
-
export * from "./services";
|
|
6
|
-
export * from "./statebuilders/views";
|
|
7
|
-
export * from "./stateProvider";
|
|
8
|
-
import "./injectables";
|
|
9
|
-
import "./directives/stateDirectives";
|
|
10
|
-
import "./stateFilters";
|
|
11
|
-
import "./directives/viewDirective";
|
|
12
|
-
import "./viewScroll";
|
|
13
|
-
declare const _default: "router";
|
|
14
|
-
export default _default;
|
|
15
|
-
import * as core from "./core/index";
|
|
16
|
-
export { core };
|
|
17
|
-
export * from "./core/index";
|
|
@@ -1,500 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
StateDeclaration,
|
|
3
|
-
_ViewDeclaration,
|
|
4
|
-
IInjectable,
|
|
5
|
-
Transition,
|
|
6
|
-
HookResult,
|
|
7
|
-
} from "./core";
|
|
8
|
-
/**
|
|
9
|
-
* The signature for Angular 1 State Transition Hooks.
|
|
10
|
-
*
|
|
11
|
-
* State hooks are registered as onEnter/onRetain/onExit in state declarations.
|
|
12
|
-
* State hooks can additionally be injected with $transition$ and $state$ for
|
|
13
|
-
* the current [[Transition]] and [[StateObject]] in the transition.
|
|
14
|
-
*
|
|
15
|
-
* Transition State Hooks are callback functions that hook into the lifecycle events of specific states during a transition.
|
|
16
|
-
* As a transition runs, it may exit some states, retain (keep) states, and enter states.
|
|
17
|
-
* As each lifecycle event occurs, the hooks which are registered for the event and that state are called (in priority order).
|
|
18
|
-
*
|
|
19
|
-
* #### See also:
|
|
20
|
-
*
|
|
21
|
-
* - [[IHookRegistry.onExit]]
|
|
22
|
-
* - [[IHookRegistry.onRetain]]
|
|
23
|
-
* - [[IHookRegistry.onEnter]]
|
|
24
|
-
*
|
|
25
|
-
* #### Example:
|
|
26
|
-
* ```js
|
|
27
|
-
* onEnter: function() { console.log('Entering'); }
|
|
28
|
-
* ```
|
|
29
|
-
*
|
|
30
|
-
* Not minification-safe
|
|
31
|
-
* ```js
|
|
32
|
-
* onRetain: function($state$) { console.log('Retained ' + $state$.name); }
|
|
33
|
-
* ```
|
|
34
|
-
*
|
|
35
|
-
* Annotated for minification-safety
|
|
36
|
-
* ```js
|
|
37
|
-
* onExit: [ '$transition$', '$state', function($transition$, $state) {
|
|
38
|
-
* // always redirect to 'foo' state when being exited
|
|
39
|
-
* if ($transition$.to().name !== 'foo') {
|
|
40
|
-
* return $state.target('foo');
|
|
41
|
-
* }
|
|
42
|
-
* } ]
|
|
43
|
-
* ```
|
|
44
|
-
*
|
|
45
|
-
* @returns an optional [[HookResult]] which may alter the transition
|
|
46
|
-
*/
|
|
47
|
-
export interface Ng1StateTransitionHook {
|
|
48
|
-
(...injectables: any[]): HookResult;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* @internalapi
|
|
52
|
-
* an intermediate interface.
|
|
53
|
-
*
|
|
54
|
-
* Used to reset [[StateDeclaration]] typings to `any` so the [[Ng1StateDeclaration]] interface can then narrow them */
|
|
55
|
-
export interface _Ng1StateDeclaration extends StateDeclaration {
|
|
56
|
-
onExit?: any;
|
|
57
|
-
onRetain?: any;
|
|
58
|
-
onEnter?: any;
|
|
59
|
-
views?: any;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* The StateDeclaration object is used to define a state or nested state.
|
|
63
|
-
* It should be registered with the [[StateRegistry]].
|
|
64
|
-
*
|
|
65
|
-
* #### Example:
|
|
66
|
-
* ```js
|
|
67
|
-
* // StateDeclaration object
|
|
68
|
-
* var foldersState = {
|
|
69
|
-
* name: 'folders',
|
|
70
|
-
* url: '/folders',
|
|
71
|
-
* resolve: {
|
|
72
|
-
* allfolders: function(FolderService) {
|
|
73
|
-
* return FolderService.list();
|
|
74
|
-
* }
|
|
75
|
-
* },
|
|
76
|
-
* template: "<ul><li ng-repeat='folder in allfolders'>{{folder.name}}</li></ul>",
|
|
77
|
-
* controller: function(allfolders, $scope) {
|
|
78
|
-
* $scope.allfolders = allfolders;
|
|
79
|
-
* }
|
|
80
|
-
* }
|
|
81
|
-
* ```
|
|
82
|
-
*
|
|
83
|
-
* Since this interface extends [[Ng1ViewDeclaration]], any view declaration properties can be set directly
|
|
84
|
-
* on the state declaration and they will be applied to the view with the name `$default`. For example:
|
|
85
|
-
*
|
|
86
|
-
* ```js
|
|
87
|
-
* var state = {
|
|
88
|
-
* name: 'foo',
|
|
89
|
-
* url: '/foo',
|
|
90
|
-
* template: '<h1>foo</h1>',
|
|
91
|
-
* controller: 'FooController'
|
|
92
|
-
* }
|
|
93
|
-
* ```
|
|
94
|
-
*
|
|
95
|
-
* is simply syntactic sugar for:
|
|
96
|
-
*
|
|
97
|
-
* ```js
|
|
98
|
-
* var state = {
|
|
99
|
-
* name: 'foo',
|
|
100
|
-
* url: '/foo',
|
|
101
|
-
* views: {
|
|
102
|
-
* $default: {
|
|
103
|
-
* template: '<h1>foo</h1>',
|
|
104
|
-
* controller: 'FooController'
|
|
105
|
-
* }
|
|
106
|
-
* }
|
|
107
|
-
* }
|
|
108
|
-
* ```
|
|
109
|
-
*
|
|
110
|
-
* If a state definition contains a `views:` object, any view properties set directly on the state are ignored.
|
|
111
|
-
* Thus, this is an invalid state defintion:
|
|
112
|
-
*
|
|
113
|
-
* ```js
|
|
114
|
-
* var state = {
|
|
115
|
-
* name: 'foo',
|
|
116
|
-
* url: '/foo',
|
|
117
|
-
* controller: 'FooController', // invalid because views: exists
|
|
118
|
-
* views: {
|
|
119
|
-
* header: {
|
|
120
|
-
* template: '<h1>header</h1>'
|
|
121
|
-
* }
|
|
122
|
-
* }
|
|
123
|
-
* }
|
|
124
|
-
* ```
|
|
125
|
-
*/
|
|
126
|
-
export interface Ng1StateDeclaration
|
|
127
|
-
extends _Ng1StateDeclaration,
|
|
128
|
-
Ng1ViewDeclaration {}
|
|
129
|
-
export interface Ng1ViewDeclaration extends _ViewDeclaration {
|
|
130
|
-
/**
|
|
131
|
-
* The name of the component to use for this view.
|
|
132
|
-
*
|
|
133
|
-
* A property of [[Ng1StateDeclaration]] or [[Ng1ViewDeclaration]]:
|
|
134
|
-
*
|
|
135
|
-
* The name of an [angular 1.5+ `.component()`](https://docs.angularjs.org/guide/component) (or directive with
|
|
136
|
-
* bindToController and/or scope declaration) which will be used for this view.
|
|
137
|
-
*
|
|
138
|
-
* Resolve data can be provided to the component via the component's `bindings` object (for 1.3+ directives, the
|
|
139
|
-
* `bindToController` is used; for other directives, the `scope` declaration is used). For each binding declared
|
|
140
|
-
* on the component, any resolve with the same name is set on the component's controller instance. The binding
|
|
141
|
-
* is provided to the component as a one-time-binding. In general, components should likewise declare their
|
|
142
|
-
* input bindings as [one-way ("<")](https://docs.angularjs.org/api/ng/service/$compile#-scope-).
|
|
143
|
-
*
|
|
144
|
-
* Note: inside a "views:" block, a bare string `"foo"` is shorthand for `{ component: "foo" }`
|
|
145
|
-
*
|
|
146
|
-
* Note: Mapping from resolve names to component inputs may be specified using [[bindings]].
|
|
147
|
-
*
|
|
148
|
-
* #### Example:
|
|
149
|
-
* ```js
|
|
150
|
-
* .state('profile', {
|
|
151
|
-
* // Use the <my-profile></my-profile> component for the Unnamed view
|
|
152
|
-
* component: 'MyProfile',
|
|
153
|
-
* }
|
|
154
|
-
*
|
|
155
|
-
* .state('messages', {
|
|
156
|
-
* // use the <nav-bar></nav-bar> component for the view named 'header'
|
|
157
|
-
* // use the <message-list></message-list> component for the view named 'content'
|
|
158
|
-
* views: {
|
|
159
|
-
* header: { component: 'NavBar' },
|
|
160
|
-
* content: { component: 'MessageList' }
|
|
161
|
-
* }
|
|
162
|
-
* }
|
|
163
|
-
*
|
|
164
|
-
* .state('contacts', {
|
|
165
|
-
* // Inside a "views:" block, a bare string "NavBar" is shorthand for { component: "NavBar" }
|
|
166
|
-
* // use the <nav-bar></nav-bar> component for the view named 'header'
|
|
167
|
-
* // use the <contact-list></contact-list> component for the view named 'content'
|
|
168
|
-
* views: {
|
|
169
|
-
* header: 'NavBar',
|
|
170
|
-
* content: 'ContactList'
|
|
171
|
-
* }
|
|
172
|
-
* }
|
|
173
|
-
* ```
|
|
174
|
-
*
|
|
175
|
-
*
|
|
176
|
-
* Note: When using `component` to define a view, you may _not_ use any of: `template`, `templateUrl`,
|
|
177
|
-
* `templateProvider`, `controller`, `controllerProvider`, `controllerAs`.
|
|
178
|
-
*
|
|
179
|
-
*
|
|
180
|
-
* See also: Todd Motto's angular 1.3 and 1.4 [backport of .component()](https://github.com/toddmotto/angular-component)
|
|
181
|
-
*/
|
|
182
|
-
component?: string;
|
|
183
|
-
/**
|
|
184
|
-
* An object which maps `resolve`s to [[component]] `bindings`.
|
|
185
|
-
*
|
|
186
|
-
* A property of [[Ng1StateDeclaration]] or [[Ng1ViewDeclaration]]:
|
|
187
|
-
*
|
|
188
|
-
* When using a [[component]] declaration (`component: 'myComponent'`), each input binding for the component is supplied
|
|
189
|
-
* data from a resolve of the same name, by default. You may supply data from a different resolve name by mapping it here.
|
|
190
|
-
*
|
|
191
|
-
* Each key in this object is the name of one of the component's input bindings.
|
|
192
|
-
* Each value is the name of the resolve that should be provided to that binding.
|
|
193
|
-
*
|
|
194
|
-
* Any component bindings that are omitted from this map get the default behavior of mapping to a resolve of the
|
|
195
|
-
* same name.
|
|
196
|
-
*
|
|
197
|
-
* #### Example:
|
|
198
|
-
* ```js
|
|
199
|
-
* $stateProvider.state('foo', {
|
|
200
|
-
* resolve: {
|
|
201
|
-
* foo: function(FooService) { return FooService.get(); },
|
|
202
|
-
* bar: function(BarService) { return BarService.get(); }
|
|
203
|
-
* },
|
|
204
|
-
* component: 'Baz',
|
|
205
|
-
* // The component's `baz` binding gets data from the `bar` resolve
|
|
206
|
-
* // The component's `foo` binding gets data from the `foo` resolve (default behavior)
|
|
207
|
-
* bindings: {
|
|
208
|
-
* baz: 'bar'
|
|
209
|
-
* }
|
|
210
|
-
* });
|
|
211
|
-
*
|
|
212
|
-
* app.component('Baz', {
|
|
213
|
-
* templateUrl: 'baz.html',
|
|
214
|
-
* controller: 'BazController',
|
|
215
|
-
* bindings: {
|
|
216
|
-
* foo: '<', // foo binding
|
|
217
|
-
* baz: '<' // baz binding
|
|
218
|
-
* }
|
|
219
|
-
* });
|
|
220
|
-
* ```
|
|
221
|
-
*
|
|
222
|
-
*/
|
|
223
|
-
bindings?: {
|
|
224
|
-
[key: string]: string;
|
|
225
|
-
};
|
|
226
|
-
/**
|
|
227
|
-
* Dynamic component provider function.
|
|
228
|
-
*
|
|
229
|
-
* A property of [[Ng1StateDeclaration]] or [[Ng1ViewDeclaration]]:
|
|
230
|
-
*
|
|
231
|
-
* This is an injectable provider function which returns the name of the component to use.
|
|
232
|
-
* The provider will invoked during a Transition in which the view's state is entered.
|
|
233
|
-
* The provider is called after the resolve data is fetched.
|
|
234
|
-
*
|
|
235
|
-
* #### Example:
|
|
236
|
-
* ```js
|
|
237
|
-
* componentProvider: function(MyResolveData, $transition$) {
|
|
238
|
-
* if (MyResolveData.foo) {
|
|
239
|
-
* return "fooComponent"
|
|
240
|
-
* } else if ($transition$.to().name === 'bar') {
|
|
241
|
-
* return "barComponent";
|
|
242
|
-
* }
|
|
243
|
-
* }
|
|
244
|
-
* ```
|
|
245
|
-
*/
|
|
246
|
-
componentProvider?: IInjectable;
|
|
247
|
-
/**
|
|
248
|
-
* The view's controller function or name
|
|
249
|
-
*
|
|
250
|
-
* A property of [[Ng1StateDeclaration]] or [[Ng1ViewDeclaration]]:
|
|
251
|
-
*
|
|
252
|
-
* The controller function, or the name of a registered controller. The controller function will be used
|
|
253
|
-
* to control the contents of the [[directives.ngView]] directive.
|
|
254
|
-
*
|
|
255
|
-
* If specified as a string, controllerAs can be declared here, i.e., "FooController as foo" instead of in
|
|
256
|
-
* a separate [[controllerAs]] property.
|
|
257
|
-
*
|
|
258
|
-
* See: [[Ng1Controller]] for information about component-level router hooks.
|
|
259
|
-
*/
|
|
260
|
-
controller?: IInjectable | string;
|
|
261
|
-
/**
|
|
262
|
-
* A controller alias name.
|
|
263
|
-
*
|
|
264
|
-
* A property of [[Ng1StateDeclaration]] or [[Ng1ViewDeclaration]]:
|
|
265
|
-
*
|
|
266
|
-
* If present, the controller will be published to scope under the `controllerAs` name.
|
|
267
|
-
* See: https://docs.angularjs.org/api/ng/directive/ngController
|
|
268
|
-
*/
|
|
269
|
-
controllerAs?: string;
|
|
270
|
-
/**
|
|
271
|
-
* Dynamic controller provider function.
|
|
272
|
-
*
|
|
273
|
-
* A property of [[Ng1StateDeclaration]] or [[Ng1ViewDeclaration]]:
|
|
274
|
-
*
|
|
275
|
-
* This is an injectable provider function which returns the actual controller function, or the name
|
|
276
|
-
* of a registered controller. The provider will invoked during a Transition in which the view's state is
|
|
277
|
-
* entered. The provider is called after the resolve data is fetched.
|
|
278
|
-
*
|
|
279
|
-
* #### Example:
|
|
280
|
-
* ```js
|
|
281
|
-
* controllerProvider: function(MyResolveData, $transition$) {
|
|
282
|
-
* if (MyResolveData.foo) {
|
|
283
|
-
* return "FooCtrl"
|
|
284
|
-
* } else if ($transition$.to().name === 'bar') {
|
|
285
|
-
* return "BarCtrl";
|
|
286
|
-
* } else {
|
|
287
|
-
* return function($scope) {
|
|
288
|
-
* $scope.baz = "Qux";
|
|
289
|
-
* }
|
|
290
|
-
* }
|
|
291
|
-
* }
|
|
292
|
-
* ```
|
|
293
|
-
*/
|
|
294
|
-
controllerProvider?: IInjectable;
|
|
295
|
-
/**
|
|
296
|
-
* The scope variable name to use for resolve data.
|
|
297
|
-
*
|
|
298
|
-
* A property of [[Ng1StateDeclaration]] or [[Ng1ViewDeclaration]]:
|
|
299
|
-
*
|
|
300
|
-
* When a view is activated, the resolved data for the state which the view belongs to is put on the scope.
|
|
301
|
-
* This property sets the name of the scope variable to use for the resolved data.
|
|
302
|
-
*
|
|
303
|
-
* Defaults to `$resolve`.
|
|
304
|
-
*/
|
|
305
|
-
resolveAs?: string;
|
|
306
|
-
/**
|
|
307
|
-
* The HTML template for the view.
|
|
308
|
-
*
|
|
309
|
-
* A property of [[Ng1StateDeclaration]] or [[Ng1ViewDeclaration]]:
|
|
310
|
-
*
|
|
311
|
-
* HTML template as a string, or a function which returns an html template as a string.
|
|
312
|
-
* This template will be used to render the corresponding [[directives.ngView]] directive.
|
|
313
|
-
*
|
|
314
|
-
* This property takes precedence over templateUrl.
|
|
315
|
-
*
|
|
316
|
-
* If `template` is a function, it will be called with the Transition parameters as the first argument.
|
|
317
|
-
*
|
|
318
|
-
* #### Example:
|
|
319
|
-
* ```js
|
|
320
|
-
* template: "<h1>inline template definition</h1><div ui-view></div>"
|
|
321
|
-
* ```
|
|
322
|
-
*
|
|
323
|
-
* #### Example:
|
|
324
|
-
* ```js
|
|
325
|
-
* template: function(params) {
|
|
326
|
-
* return "<h1>generated template</h1>";
|
|
327
|
-
* }
|
|
328
|
-
* ```
|
|
329
|
-
*/
|
|
330
|
-
template?: Function | string;
|
|
331
|
-
/**
|
|
332
|
-
* The URL for the HTML template for the view.
|
|
333
|
-
*
|
|
334
|
-
* A property of [[Ng1StateDeclaration]] or [[Ng1ViewDeclaration]]:
|
|
335
|
-
*
|
|
336
|
-
* A path or a function that returns a path to an html template.
|
|
337
|
-
* The template will be fetched and used to render the corresponding [[directives.ngView]] directive.
|
|
338
|
-
*
|
|
339
|
-
* If `templateUrl` is a function, it will be called with the Transition parameters as the first argument.
|
|
340
|
-
*
|
|
341
|
-
* #### Example:
|
|
342
|
-
* ```js
|
|
343
|
-
* templateUrl: "/templates/home.html"
|
|
344
|
-
* ```
|
|
345
|
-
*
|
|
346
|
-
* #### Example:
|
|
347
|
-
* ```js
|
|
348
|
-
* templateUrl: function(params) {
|
|
349
|
-
* return myTemplates[params.pageId];
|
|
350
|
-
* }
|
|
351
|
-
* ```
|
|
352
|
-
*/
|
|
353
|
-
templateUrl?: string | Function;
|
|
354
|
-
/**
|
|
355
|
-
* Injected function which returns the HTML template.
|
|
356
|
-
*
|
|
357
|
-
* A property of [[Ng1StateDeclaration]] or [[Ng1ViewDeclaration]]:
|
|
358
|
-
*
|
|
359
|
-
* Injected function which returns the HTML template.
|
|
360
|
-
* The template will be used to render the corresponding [[directives.ngView]] directive.
|
|
361
|
-
*
|
|
362
|
-
* #### Example:
|
|
363
|
-
* ```js
|
|
364
|
-
* templateProvider: function(MyTemplateService, $transition$) {
|
|
365
|
-
* return MyTemplateService.getTemplate($transition$.params().pageId);
|
|
366
|
-
* }
|
|
367
|
-
* ```
|
|
368
|
-
*/
|
|
369
|
-
templateProvider?: IInjectable;
|
|
370
|
-
}
|
|
371
|
-
/**
|
|
372
|
-
* The shape of a controller for a view (and/or component), defining the controller callbacks.
|
|
373
|
-
*
|
|
374
|
-
* A view in Router is comprised of either a `component` ([[Ng1ViewDeclaration.component]]) or a combination of a
|
|
375
|
-
* `template` (or `templateProvider`) and a `controller` (or `controllerProvider`).
|
|
376
|
-
*
|
|
377
|
-
* The `controller` object (or the `component`'s controller object) can define component-level controller callbacks,
|
|
378
|
-
* which Router will call at the appropriate times. These callbacks are similar to Transition Hooks
|
|
379
|
-
* ([[IHookRegistry]]), but are only called if the view is currently active.
|
|
380
|
-
*
|
|
381
|
-
* This interface defines the Router component callbacks.
|
|
382
|
-
*
|
|
383
|
-
*/
|
|
384
|
-
export interface Ng1Controller {
|
|
385
|
-
/** @hidden */
|
|
386
|
-
$onInit(): void;
|
|
387
|
-
/**
|
|
388
|
-
* This callback is called when parameter values have changed.
|
|
389
|
-
*
|
|
390
|
-
* This callback can be used to respond to changing parameter values in the current state, or in parent/child states.
|
|
391
|
-
* This callback is especially handy when using dynamic parameters ([[ParamDeclaration.dynamic]])
|
|
392
|
-
*
|
|
393
|
-
* Called when:
|
|
394
|
-
* - The view is still active
|
|
395
|
-
* - A new transition has completed successfully
|
|
396
|
-
* - The state for the view (controller) was not reloaded
|
|
397
|
-
* - At least one parameter value was changed
|
|
398
|
-
*
|
|
399
|
-
* Called with:
|
|
400
|
-
* @param newValues an object containing the changed parameter values
|
|
401
|
-
* @param $transition$ the new Transition which triggered this callback
|
|
402
|
-
*
|
|
403
|
-
* #### Example:
|
|
404
|
-
* ```js
|
|
405
|
-
* angular.module('foo').controller('FancyCtrl', function() {
|
|
406
|
-
* this.uiOnParamsChanged = function(newParams) {
|
|
407
|
-
* console.log("new params: ", newParams);
|
|
408
|
-
* }
|
|
409
|
-
* });
|
|
410
|
-
* ```
|
|
411
|
-
*/
|
|
412
|
-
uiOnParamsChanged(newValues: any, $transition$: Transition): void;
|
|
413
|
-
/**
|
|
414
|
-
* This callback is called when the view's state is about to be exited.
|
|
415
|
-
*
|
|
416
|
-
* This callback is used to inform a view that it is about to be exited, due to a new [[Transition]].
|
|
417
|
-
* The callback can ask for user confirmation, and cancel or alter the new Transition. The callback should
|
|
418
|
-
* return a value, or a promise for a value. If a promise is returned, the new Transition waits until the
|
|
419
|
-
* promise settles.
|
|
420
|
-
*
|
|
421
|
-
*
|
|
422
|
-
* Called when:
|
|
423
|
-
* - The view is still active
|
|
424
|
-
* - A new Transition is about to run
|
|
425
|
-
* - The new Transition will exit the view's state
|
|
426
|
-
*
|
|
427
|
-
* Called with:
|
|
428
|
-
* - The new Transition
|
|
429
|
-
*
|
|
430
|
-
* Relevant return Values:
|
|
431
|
-
* - `false`: The transition is cancelled.
|
|
432
|
-
* - A rejected promise: The transition is cancelled.
|
|
433
|
-
* - [[TargetState]]: The transition is redirected to the new target state.
|
|
434
|
-
* - Anything else: the transition will continue normally (the state and view will be deactivated)
|
|
435
|
-
*
|
|
436
|
-
* #### Example:
|
|
437
|
-
* ```js
|
|
438
|
-
* app.component('myComponent', {
|
|
439
|
-
* template: '<input ng-model="$ctrl.data" type="text">',
|
|
440
|
-
* bindings: { 'data': '<' },
|
|
441
|
-
* controller: function() {
|
|
442
|
-
*
|
|
443
|
-
* this.originalData = angular.copy(this.data);
|
|
444
|
-
*
|
|
445
|
-
* this.uiCanExit = function() {
|
|
446
|
-
* if (!angular.equals(this.data, this.originalData)) {
|
|
447
|
-
* // Note: This could also return a Promise and request async
|
|
448
|
-
* // confirmation using something like ui-bootstrap $modal
|
|
449
|
-
* return window.confirm("Data has changed. Exit anyway and lose changes?");
|
|
450
|
-
* }
|
|
451
|
-
* }
|
|
452
|
-
* }
|
|
453
|
-
* }
|
|
454
|
-
* ```
|
|
455
|
-
*
|
|
456
|
-
* @param transition the new Transition that is about to exit the component's state
|
|
457
|
-
* @return a HookResult, or a promise for a HookResult
|
|
458
|
-
*/
|
|
459
|
-
uiCanExit(transition: Transition): HookResult;
|
|
460
|
-
}
|
|
461
|
-
/**
|
|
462
|
-
* Manages which template-loading mechanism to use.
|
|
463
|
-
*
|
|
464
|
-
* Defaults to `$templateRequest` on Angular versions starting from 1.3, `$http` otherwise.
|
|
465
|
-
*/
|
|
466
|
-
export interface TemplateFactoryProvider {
|
|
467
|
-
/**
|
|
468
|
-
* Forces $templateFactory to use $http instead of $templateRequest.
|
|
469
|
-
*
|
|
470
|
-
* Router uses `$templateRequest` by default on angular 1.3+.
|
|
471
|
-
* Use this method to choose to use `$http` instead.
|
|
472
|
-
*
|
|
473
|
-
* ---
|
|
474
|
-
*
|
|
475
|
-
* ## Security warning
|
|
476
|
-
*
|
|
477
|
-
* This might cause XSS, as $http doesn't enforce the regular security checks for
|
|
478
|
-
* templates that have been introduced in Angular 1.3.
|
|
479
|
-
*
|
|
480
|
-
* See the $sce documentation, section
|
|
481
|
-
* <a href="https://docs.angularjs.org/api/ng/service/$sce#impact-on-loading-templates">
|
|
482
|
-
* Impact on loading templates</a> for more details about this mechanism.
|
|
483
|
-
*
|
|
484
|
-
* *Note: forcing this to `false` on Angular 1.2.x will crash, because `$templateRequest` is not implemented.*
|
|
485
|
-
*
|
|
486
|
-
* @param useUnsafeHttpService `true` to use `$http` to fetch templates
|
|
487
|
-
*/
|
|
488
|
-
useHttpService(useUnsafeHttpService: boolean): any;
|
|
489
|
-
}
|
|
490
|
-
declare module "@uirouter/core/lib/state/stateRegistry" {
|
|
491
|
-
interface StateRegistry {
|
|
492
|
-
register(
|
|
493
|
-
state:
|
|
494
|
-
| Ng1StateDeclaration
|
|
495
|
-
| {
|
|
496
|
-
new (): Ng1StateDeclaration;
|
|
497
|
-
},
|
|
498
|
-
): any;
|
|
499
|
-
}
|
|
500
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { Obj } from "../core";
|
|
2
|
-
/** @hidden */
|
|
3
|
-
export declare const resolveFactory: () => {
|
|
4
|
-
/**
|
|
5
|
-
* Asynchronously injects a resolve block.
|
|
6
|
-
*
|
|
7
|
-
* This emulates most of the behavior of the ui-router 0.2.x $resolve.resolve() service API.
|
|
8
|
-
*
|
|
9
|
-
* ### Not bundled by default
|
|
10
|
-
*
|
|
11
|
-
* This API is no longer not part of the standard `@uirouter/angularjs` bundle.
|
|
12
|
-
* For users of the prebuilt bundles, add the `release/resolveService.min.js` UMD bundle.
|
|
13
|
-
* For bundlers (webpack, browserify, etc), add `@uirouter/angularjs/lib/legacy/resolveService`.
|
|
14
|
-
*
|
|
15
|
-
* ---
|
|
16
|
-
*
|
|
17
|
-
* Given an object `invocables`, where keys are strings and values are injectable functions,
|
|
18
|
-
* injects each function, and waits for the resulting promise to resolve.
|
|
19
|
-
* When all resulting promises are resolved, returns the results as an object.
|
|
20
|
-
*
|
|
21
|
-
* #### Example:
|
|
22
|
-
* ```js
|
|
23
|
-
* let invocables = {
|
|
24
|
-
* foo: [ '$http', ($http) =>
|
|
25
|
-
* $http.get('/api/foo').then(resp => resp.data) ],
|
|
26
|
-
* bar: [ 'foo', '$http', (foo, $http) =>
|
|
27
|
-
* $http.get('/api/bar/' + foo.barId).then(resp => resp.data) ]
|
|
28
|
-
* }
|
|
29
|
-
* $resolve.resolve(invocables)
|
|
30
|
-
* .then(results => console.log(results.foo, results.bar))
|
|
31
|
-
* // Logs foo and bar:
|
|
32
|
-
* // { id: 123, barId: 456, fooData: 'foo data' }
|
|
33
|
-
* // { id: 456, barData: 'bar data' }
|
|
34
|
-
* ```
|
|
35
|
-
*
|
|
36
|
-
* @param invocables an object which looks like an [[StateDeclaration.resolve]] object; keys are resolve names and values are injectable functions
|
|
37
|
-
* @param locals key/value pre-resolved data (locals)
|
|
38
|
-
* @param parent a promise for a "parent resolve"
|
|
39
|
-
*/
|
|
40
|
-
resolve: (
|
|
41
|
-
invocables: {
|
|
42
|
-
[key: string]: Function;
|
|
43
|
-
},
|
|
44
|
-
locals?: {},
|
|
45
|
-
parent?: Promise<any>,
|
|
46
|
-
) => Promise<Obj>;
|
|
47
|
-
};
|