import { CssSelector } from 'Angular2.src.render.dom.compiler.selector'; const selector = new CssSelector('.my-class'); console.log(selector.toString()); // ".my-class"
import { CssSelector } from 'Angular2.src.render.dom.compiler.selector'; const selector = new CssSelector('[attr=value]'); console.log(selector.element); // "null" console.log(selector.attrs); // [{ name: "attr", value: "value" }]In this example, we create a new instance with a selector for an element with a specific attribute value. We then access the element and attrs properties to see what the selector is targeting. Overall, the CssSelector class is useful for working with CSS selectors in an Angular application.