` or any other element with the
* `tooltip` selector,
* like so:
- *
+ *
* ```
*
* ```
- *
+ *
* Directives can also control the instantiation, destruction, and positioning of inline template
* elements:
- *
+ *
* A directive uses a {@link ViewContainerRef} to instantiate, insert, move, and destroy views at
* runtime.
* The {@link ViewContainerRef} is created as a result of `
` element, and represents a
* location in the current view
* where these actions are performed.
- *
+ *
* Views are always created as children of the current {@link ViewMetadata}, and as siblings of the
* `` element. Thus a
* directive in a child view cannot inject the directive that created it.
- *
+ *
* Since directives that create views via ViewContainers are common in Angular, and using the full
* `` element syntax is wordy, Angular
* also supports a shorthand notation: `` and `` are
* equivalent.
- *
+ *
* Thus,
- *
+ *
* ```
*
* ```
- *
+ *
* Expands in use to:
- *
+ *
* ```
*
*
@@ -446,18 +446,18 @@ declare module ng {
*
*
* ```
- *
+ *
* Notice that although the shorthand places `*foo="bar"` within the `` element, the binding for
* the directive
* controller is correctly instantiated on the `` element rather than the `` element.
- *
- *
+ *
+ *
* ## Example
- *
+ *
* Let's suppose we want to implement the `unless` behavior, to conditionally include a template.
- *
+ *
* Here is a simple directive that triggers on an `unless` selector:
- *
+ *
* ```
* @Directive({
* selector: '[unless]',
@@ -467,13 +467,13 @@ declare module ng {
* viewContainer: ViewContainerRef;
* templateRef: TemplateRef;
* prevCondition: boolean;
- *
+ *
* constructor(viewContainer: ViewContainerRef, templateRef: TemplateRef) {
* this.viewContainer = viewContainer;
* this.templateRef = templateRef;
* this.prevCondition = null;
* }
- *
+ *
* set unless(newCondition) {
* if (newCondition && (isBlank(this.prevCondition) || !this.prevCondition)) {
* this.prevCondition = true;
@@ -485,17 +485,17 @@ declare module ng {
* }
* }
* ```
- *
+ *
* We can then use this `unless` selector in a template:
* ```
*
* ```
- *
+ *
* Once the directive instantiates the child view, the shorthand notation for the template expands
* and the result is:
- *
+ *
* ```
*
*
@@ -504,66 +504,66 @@ declare module ng {
*
*
* ```
- *
+ *
* Note also that although the `` template still exists inside the ``,
* the instantiated
* view occurs on the second `` which is a sibling to the `` element.
*/
class DirectiveMetadata extends InjectableMetadata {
-
+
/**
* The CSS selector that triggers the instantiation of a directive.
- *
+ *
* Angular only allows directives to trigger on CSS selectors that do not cross element
* boundaries.
- *
+ *
* `selector` may be declared as one of the following:
- *
+ *
* - `element-name`: select by element name.
* - `.class`: select by class name.
* - `[attribute]`: select by attribute name.
* - `[attribute=value]`: select by attribute name and value.
* - `:not(sub_selector)`: select only if the element does not match the `sub_selector`.
* - `selector1, selector2`: select if either `selector1` or `selector2` matches.
- *
- *
+ *
+ *
* ## Example
- *
+ *
* Suppose we have a directive with an `input[type=text]` selector.
- *
+ *
* And the following HTML:
- *
+ *
* ```html
*