W3cubDocs

/Angular 2

By

Experimental Class

Class Overview

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

Class Description

Predicates for use with DebugElement's query functions.

Static Members

all() : Predicate<DebugElement>

Match all elements.

debugElement.query(By.all());
css(selector: string) : Predicate<DebugElement>

Match elements by the given CSS selector.

debugElement.query(By.css('[attribute]'));
directive(type: Type<any>) : Predicate<DebugElement>

Match elements that have the given directive present.

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

exported from @angular/platform-browser/index, defined in @angular/platform-browser/src/dom/debug/by.ts

© 2010–2017 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://v2.angular.io/docs/ts/latest/api/platform-browser/index/By-class.html