@@ -15,88 +15,6 @@ export class UrlRules {
1515 _rules : any [ ] ;
1616 _id : number ;
1717 _urlRuleFactory : UrlRuleFactory ;
18- /**
19- * Defines the initial state, path, or behavior to use when the app starts.
20- *
21- * This rule defines the initial/starting state for the application.
22- *
23- * This rule is triggered the first time the URL is checked (when the app initially loads).
24- * The rule is triggered only when the url matches either `""` or `"/"`.
25- *
26- * Note: The rule is intended to be used when the root of the application is directly linked to.
27- * When the URL is *not* `""` or `"/"` and doesn't match other rules, the [[otherwise]] rule is triggered.
28- * This allows 404-like behavior when an unknown URL is deep-linked.
29- *
30- * #### Example:
31- * Start app at `home` state.
32- * ```js
33- * .initial({ state: 'home' });
34- * ```
35- *
36- * #### Example:
37- * Start app at `/home` (by url)
38- * ```js
39- * .initial('/home');
40- * ```
41- *
42- * #### Example:
43- * When no other url rule matches, go to `home` state
44- * ```js
45- * .initial((matchValue, url, router) => {
46- * console.log('initial state');
47- * return { state: 'home' };
48- * })
49- * ```
50- *
51- * @param handler The initial state or url path, or a function which returns the state or url path (or performs custom logic).
52- */
53- initial ( handler : any ) : void ;
54- /**
55- * Defines the state, url, or behavior to use when no other rule matches the URL.
56- *
57- * This rule is matched when *no other rule* matches.
58- * It is generally used to handle unknown URLs (similar to "404" behavior, but on the client side).
59- *
60- * - If `handler` a string, it is treated as a url redirect
61- *
62- * #### Example:
63- * When no other url rule matches, redirect to `/index`
64- * ```js
65- * .otherwise('/index');
66- * ```
67- *
68- * - If `handler` is an object with a `state` property, the state is activated.
69- *
70- * #### Example:
71- * When no other url rule matches, redirect to `home` and provide a `dashboard` parameter value.
72- * ```js
73- * .otherwise({ state: 'home', params: { dashboard: 'default' } });
74- * ```
75- *
76- * - If `handler` is a function, the function receives the current url ([[UrlParts]]) and the [[UIRouter]] object.
77- * The function can perform actions, and/or return a value.
78- *
79- * #### Example:
80- * When no other url rule matches, manually trigger a transition to the `home` state
81- * ```js
82- * .otherwise((matchValue, urlParts, router) => {
83- * router.stateService.go('home');
84- * });
85- * ```
86- *
87- * #### Example:
88- * When no other url rule matches, go to `home` state
89- * ```js
90- * .otherwise((matchValue, urlParts, router) => {
91- * return { state: 'home' };
92- * });
93- * ```
94- *
95- * @param handler The url path to redirect to, or a function which returns the url path (or performs custom logic).
96- */
97- otherwise ( handler : any ) : void ;
98- _otherwiseFn : import ( "./url-rule.js" ) . BaseUrlRule ;
99- _sorted : boolean ;
10018 /**
10119 * Remove a rule previously registered
10220 *
@@ -116,6 +34,7 @@ export class UrlRules {
11634 * @returns {() => void } a function that deregisters the rule
11735 */
11836 rule ( rule : any ) : ( ) => void ;
37+ _sorted : boolean ;
11938 /**
12039 * Gets all registered rules
12140 *
0 commit comments