By

Predicates for use with DebugElement's query functions.

class By { static all(): Predicate<DebugElement> static css(selector: string): Predicate<DebugElement> static directive(type: Type<any>): Predicate<DebugElement> }

静态方法

Match all elements.

static all(): Predicate<DebugElement>

参数

没有参数。

返回值

Predicate<DebugElement>

Example

debugElement.query(By.all());

Match elements by the given CSS selector.

static css(selector: string): Predicate<DebugElement>

参数

selector

Type: string.

返回值

Predicate<DebugElement>

Example

debugElement.query(By.css('[attribute]'));

Match elements that have the given directive present.

static directive(type: Type<any>): Predicate<DebugElement>

参数

type

Type: Type.

返回值

Predicate<DebugElement>

Example

debugElement.query(By.directive(MyDirective));