3
3
* @module params
4
4
*/ /** for typedoc */
5
5
6
- import { ParamType } from "./type " ;
6
+ import { ParamType } from "./paramType " ;
7
7
8
8
/**
9
9
* Parameter values
@@ -110,6 +110,10 @@ export interface ParamDeclaration {
110
110
*
111
111
* This defines a default value for the parameter.
112
112
* If a parameter value is `undefined`, this default value will be used instead
113
+ *
114
+ * ---
115
+ *
116
+ * Default: `undefined`
113
117
*/
114
118
value ?: any ;
115
119
@@ -123,6 +127,14 @@ export interface ParamDeclaration {
123
127
* The type may be either one of the built in types, or a custom type that has been registered with the [[UrlMatcherFactory]].
124
128
*
125
129
* See [[ParamTypes]] for the list of built in types.
130
+ *
131
+ * ---
132
+ *
133
+ * Default:
134
+ * - Path parameters (`/:fooParam`): `path`
135
+ * - Query parameters (`?queryParam`): `query`
136
+ * - Non-url parameters (`param: { foo: null }`): `any`
137
+ *
126
138
*/
127
139
type : ( string | ParamType ) ;
128
140
@@ -212,7 +224,7 @@ export interface ParamDeclaration {
212
224
* $state.go('mystate', { myparam2: 'someOtherValue' });
213
225
* ```
214
226
*
215
- * If squash is not set, it uses the configured default squash policy. (See [[defaultSquashPolicy]]())
227
+ * Default: If squash is not set, it uses the configured default squash policy. (See [[defaultSquashPolicy]]())
216
228
*/
217
229
squash : ( boolean | string ) ;
218
230
@@ -258,6 +270,10 @@ export interface ParamDeclaration {
258
270
* ---
259
271
*
260
272
* Note: this value overrides the `dynamic` value on a custom parameter type ([[ParamTypeDefinition.dynamic]]).
273
+ *
274
+ * ---
275
+ *
276
+ * Default: `false`
261
277
*/
262
278
dynamic : boolean ;
263
279
@@ -292,8 +308,45 @@ export interface ParamDeclaration {
292
308
* It's generally safe to use a raw parameter at the end of a path, like '/product/:slug'.
293
309
* However, beware of the characters you allow in your raw parameter values.
294
310
* Avoid unencoded characters that could disrupt normal URL parsing, such as `?` and `#`.
311
+ *
312
+ * ---
313
+ *
314
+ * Default: `false`
295
315
*/
296
316
raw : boolean ;
317
+
318
+ /**
319
+ * Enables/disables inheriting of this parameter value
320
+ *
321
+ * When a transition is run with [[TransitionOptions.inherit]] set to `true`, the current param values are inherited.
322
+ * Parameters values which have `inherit: false` will not be inherited.
323
+ *
324
+ * #### Example state :
325
+ * ```js
326
+ * var fooState = {
327
+ * name: 'foo',
328
+ * url: '/:fooId?mode&refresh',
329
+ * params: {
330
+ * refresh: { inherit: false }
331
+ * }
332
+ * }
333
+ *
334
+ * // Set fooId to 123
335
+ * $state.go('fooState', { fooId: 1234, mode: 'list', refresh: true });
336
+ * ```
337
+ *
338
+ * In the component:
339
+ * `mode: 'list' is inherited, but refresh: true is not inherited.
340
+ * // The param values are thus: `{ fooId: 4567, mode: 'list' }`
341
+ * ```
342
+ * <ui-sref="foo({ fooId: 4567 })">4567</ui-sref>
343
+ * ```
344
+ *
345
+ * ---
346
+ *
347
+ * Default: `true`
348
+ */
349
+ inherit : boolean ;
297
350
}
298
351
299
352
/** @internalapi */
@@ -520,5 +573,26 @@ export interface ParamTypeDefinition {
520
573
* See: [[ParamDeclaration.raw]] for details
521
574
*/
522
575
raw : boolean ;
576
+
577
+ /**
578
+ * Enables/disables inheriting of parameter values (of this type)
579
+ *
580
+ * When a transition is run with [[TransitionOptions.inherit]] set to `true`, the current param values are inherited.
581
+ * Param values whose type has `inherit: false` will not be inherited.
582
+ *
583
+ * The internal parameter type of `hash` has `inherit: false`.
584
+ * This is used to disable inheriting of the hash value (`#`) on subsequent transitions.
585
+ *
586
+ * #### Example:
587
+ * ```js
588
+ * $state.go('home', { '#': 'inboxAnchor' });
589
+ * ...
590
+ * // "#" is not inherited.
591
+ * // The value of the "#" parameter will be `null`
592
+ * // The url's hash will be cleared.
593
+ * $state.go('home.nest');
594
+ * ```
595
+ */
596
+ inherit : boolean ;
523
597
}
524
598
0 commit comments