Skip to content

Commit 4d907f6

Browse files
committed
Remove reduntant code
1 parent d9c000d commit 4d907f6

File tree

6 files changed

+197
-8
lines changed

6 files changed

+197
-8
lines changed

src/directive/repeat/repeat.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -280,12 +280,6 @@ export const ngRepeatDirective = [
280280
// However, we need to keep the reference to the jqlite wrapper as it might be changed later
281281
// by a directive with templateUrl when its template arrives.
282282
block.clone = clone;
283-
$animate.enter(clone, null, previousNode);
284-
previousNode = clone;
285-
// Note: We only need the first/last node of the cloned nodes.
286-
// However, we need to keep the reference to the jqlite wrapper as it might be changed later
287-
// by a directive with templateUrl when its template arrives.
288-
block.clone = clone;
289283
nextBlockMap[block.id] = block;
290284
updateScope(
291285
block.scope,

types/core/interpolate/interpolate.d.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,23 @@ export class InterpolateProvider {
3131
endSymbol(value?: string | undefined): string | InterpolateProvider;
3232
$get: (string | (($parse: import("../parse/parse").ParseService, $sce: any) => {
3333
(text: string, mustHaveExpression?: boolean | undefined, trustedContext?: string | undefined, allOrNothing?: boolean | undefined): Function;
34+
/**
35+
* Symbol to denote the start of expression in the interpolated string. Defaults to `{{`.
36+
*
37+
* Use {@link ng.$interpolateProvider#startSymbol `$interpolateProvider.startSymbol`} to change
38+
* the symbol.
39+
*
40+
* @returns {string} start symbol.
41+
*/
3442
startSymbol(): string;
43+
/**
44+
* Symbol to denote the end of expression in the interpolated string. Defaults to `}}`.
45+
*
46+
* Use {@link ng.$interpolateProvider#endSymbol `$interpolateProvider.endSymbol`} to change
47+
* the symbol.
48+
*
49+
* @returns {string} end symbol.
50+
*/
3551
endSymbol(): string;
3652
}))[];
3753
}

types/core/timeout/timeout.d.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
export class TimeoutProvider {
22
$get: (string | (($rootScope: import("../scope/scope").Scope, $browser: import("../../services/browser").Browser, $q: any, $exceptionHandler: import("../exception-handler").ErrorHandler) => {
33
(fn?: (() => any) | undefined, delay?: number | undefined, invokeApply?: boolean, ...args: any[]): import("../q/q").QPromise<any>;
4+
/**
5+
* Cancels a task associated with the `promise`. As a result of this, the promise will be
6+
* resolved with a rejection.
7+
*
8+
* @param {import("../q/q").QPromise<any>} promise Promise returned by the `$timeout` function.
9+
* @returns {boolean} Returns `true` if the task hasn't executed yet and was successfully
10+
* canceled.
11+
*/
412
cancel(promise: import("../q/q").QPromise<any>): boolean;
513
}))[];
614
}

types/directive/model/model.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export class NgModelController {
104104
getOption(name: string): string | boolean | number | {
105105
[x: string]: number;
106106
};
107-
createChild(options: ModelOptionsConfig): /*elided*/ any;
107+
createChild(options: ModelOptionsConfig): any;
108108
};
109109
$$updateEvents: string;
110110
$$updateEventHandler(ev: any): void;

types/router/url/url-matcher.d.ts

Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
/**
2+
* Matches URLs against patterns.
3+
*
4+
* Matches URLs against patterns and extracts named parameters from the path or the search
5+
* part of the URL.
6+
*
7+
* A URL pattern consists of a path pattern, optionally followed by '?' and a list of search (query)
8+
* parameters. Multiple search parameter names are separated by '&'. Search parameters
9+
* do not influence whether or not a URL is matched, but their values are passed through into
10+
* the matched parameters returned by [[UrlMatcher.exec]].
11+
*
12+
* - *Path parameters* are defined using curly brace placeholders (`/somepath/{param}`)
13+
* or colon placeholders (`/somePath/:param`).
14+
*
15+
* - *A parameter RegExp* may be defined for a param after a colon
16+
* (`/somePath/{param:[a-zA-Z0-9]+}`) in a curly brace placeholder.
17+
* The regexp must match for the url to be matched.
18+
* Should the regexp itself contain curly braces, they must be in matched pairs or escaped with a backslash.
19+
*
20+
* Note: a RegExp parameter will encode its value using either [[ParamTypes.path]] or [[ParamTypes.query]].
21+
*
22+
* - *Custom parameter types* may also be specified after a colon (`/somePath/{param:int}`) in curly brace parameters.
23+
* See [[UrlMatcherFactory.type]] for more information.
24+
*
25+
* - *Catch-all parameters* are defined using an asterisk placeholder (`/somepath/*catchallparam`).
26+
* A catch-all * parameter value will contain the remainder of the URL.
27+
*
28+
* ---
29+
*
30+
* Parameter names may contain only word characters (latin letters, digits, and underscore) and
31+
* must be unique within the pattern (across both path and search parameters).
32+
* A path parameter matches any number of characters other than '/'. For catch-all
33+
* placeholders the path parameter matches any number of characters.
34+
*
35+
* Examples:
36+
*
37+
* * `'/hello/'` - Matches only if the path is exactly '/hello/'. There is no special treatment for
38+
* trailing slashes, and patterns have to match the entire path, not just a prefix.
39+
* * `'/user/:id'` - Matches '/user/bob' or '/user/1234!!!' or even '/user/' but not '/user' or
40+
* '/user/bob/details'. The second path segment will be captured as the parameter 'id'.
41+
* * `'/user/{id}'` - Same as the previous example, but using curly brace syntax.
42+
* * `'/user/{id:[^/]*}'` - Same as the previous example.
43+
* * `'/user/{id:[0-9a-fA-F]{1,8}}'` - Similar to the previous example, but only matches if the id
44+
* parameter consists of 1 to 8 hex digits.
45+
* * `'/files/{path:.*}'` - Matches any URL starting with '/files/' and captures the rest of the
46+
* path into the parameter 'path'.
47+
* * `'/files/*path'` - ditto.
48+
* * `'/calendar/{start:date}'` - Matches "/calendar/2014-11-12" (because the pattern defined
49+
* in the built-in `date` ParamType matches `2014-11-12`) and provides a Date object in $stateParams.start
50+
*
51+
*/
52+
export class UrlMatcher {
53+
static encodeDashes(str: any): string;
54+
/** @internal Given a matcher, return an array with the matcher's path segments and path params, in order */
55+
static pathSegmentsAndParams(matcher: any): any;
56+
/** @internal Given a matcher, return an array with the matcher's query params */
57+
static queryParams(matcher: any): any;
58+
/**
59+
* Compare two UrlMatchers
60+
*
61+
* This comparison function converts a UrlMatcher into static and dynamic path segments.
62+
* Each static path segment is a static string between a path separator (slash character).
63+
* Each dynamic segment is a path parameter.
64+
*
65+
* The comparison function sorts static segments before dynamic ones.
66+
*/
67+
static compare(a: any, b: any): number;
68+
/**
69+
* @param pattern The pattern to compile into a matcher.
70+
* @param paramTypes The [[ParamTypes]] registry
71+
* @param paramFactory A [[ParamFactory]] object
72+
* @param config A [[UrlMatcherCompileConfig]] configuration object
73+
*/
74+
constructor(pattern: any, paramTypes: any, paramFactory: any, config: any);
75+
_cache: {
76+
path: this[];
77+
};
78+
_children: any[];
79+
_params: any[];
80+
_segments: any[];
81+
_compiled: any[];
82+
config: any;
83+
pattern: any;
84+
/**
85+
* Creates a new concatenated UrlMatcher
86+
*
87+
* Builds a new UrlMatcher by appending another UrlMatcher to this one.
88+
*
89+
* @param url A `UrlMatcher` instance to append as a child of the current `UrlMatcher`.
90+
*/
91+
append(url: any): any;
92+
isRoot(): boolean;
93+
/** Returns the input pattern string */
94+
toString(): any;
95+
_getDecodedParamValue(value: any, param: any): any;
96+
/**
97+
* Tests the specified url/path against this matcher.
98+
*
99+
* Tests if the given url matches this matcher's pattern, and returns an object containing the captured
100+
* parameter values. Returns null if the path does not match.
101+
*
102+
* The returned object contains the values
103+
* of any search parameters that are mentioned in the pattern, but their value may be null if
104+
* they are not present in `search`. This means that search parameters are always treated
105+
* as optional.
106+
*
107+
* #### Example:
108+
* ```js
109+
* new UrlMatcher('/user/{id}?q&r').exec('/user/bob', {
110+
* x: '1', q: 'hello'
111+
* });
112+
* // returns { id: 'bob', q: 'hello', r: null }
113+
* ```
114+
*
115+
* @param path The URL path to match, e.g. `$location.path()`.
116+
* @param search URL search parameters, e.g. `$location.search()`.
117+
* @param hash URL hash e.g. `$location.hash()`.
118+
*
119+
* @returns The captured parameter values.
120+
*/
121+
exec(path: any, search: {}, hash: any): {
122+
"#": any;
123+
};
124+
/**
125+
* @internal
126+
* Returns all the [[Param]] objects of all path and search parameters of this pattern in order of appearance.
127+
*
128+
* @returns {Array.<Param>} An array of [[Param]] objects. Must be treated as read-only. If the
129+
* pattern has no parameters, an empty array is returned.
130+
*/
131+
parameters(opts?: {}): Array<Param>;
132+
/**
133+
* @internal
134+
* Returns a single parameter from this UrlMatcher by id
135+
*
136+
* @param id
137+
* @param opts
138+
* @returns {Param|any|boolean|UrlMatcher|null}
139+
*/
140+
parameter(id: any, opts?: {}): Param | any | boolean | UrlMatcher | null;
141+
/**
142+
* Validates the input parameter values against this UrlMatcher
143+
*
144+
* Checks an object hash of parameters to validate their correctness according to the parameter
145+
* types of this `UrlMatcher`.
146+
*
147+
* @param params The object hash of parameters to validate.
148+
* @returns Returns `true` if `params` validates, otherwise `false`.
149+
*/
150+
validates(params: any): any;
151+
/**
152+
* Given a set of parameter values, creates a URL from this UrlMatcher.
153+
*
154+
* Creates a URL that matches this pattern by substituting the specified values
155+
* for the path and search parameters.
156+
*
157+
* #### Example:
158+
* ```js
159+
* new UrlMatcher('/user/{id}?q').format({ id:'bob', q:'yes' });
160+
* // returns '/user/bob?q=yes'
161+
* ```
162+
*
163+
* @param values the values to substitute for the parameters in this pattern.
164+
* @returns the formatted URL (path and optionally search part).
165+
*/
166+
format(values?: {}): string;
167+
}
168+
export namespace UrlMatcher {
169+
let nameValidator: RegExp;
170+
}
171+
import { Param } from "../params/param";

types/types.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ export type FormController = {
316316
* - An object containing arrays of controls with validation errors keyed by validation error keys.
317317
*/
318318
$error: {
319-
[x: string]: (NgModelController | FormController)[];
319+
[x: string]: Array<NgModelController | FormController>;
320320
};
321321
/**
322322
* - The name of the form.

0 commit comments

Comments
 (0)