chore(doc-gen): capture docs for modules from comments Closes #1258 docs(*): add module description jsdoc tags docs(*): add @public tag to public modules chore(doc-gen): fix overview-dump template The template was referencing an invalid property chore(doc-gen): use `@exportedAs` and `@public` rather than `@publicModule` This commit refactors how we describe components that are re-exported in another module. For example the "public" modules like `angular/angular` and `angular/annotations` are public but they only re-export components from "private" modules. Previously, you must apply the `@publicModule` tag to a component that was to be re-exported. Applying this tag caused the destination module to become public. Now, you specify that a module is public by applying the `@public` tag and then you can "re-export" components to other modules by applying the `@exportedAs` giving the name of the module from which the component will be re-exported. tag. This tag can be used multiple times on a single component, allowing the component to be exported on multiple modules. docs(*): rename `@publicModule` to `@exportedAs` The `@publicModule` dgeni tag has been replaced by the `@exportedAs` dgeni tag on components that are to be re-exported on another module. Closes #1290
52 lines
1.5 KiB
JavaScript
52 lines
1.5 KiB
JavaScript
import {Viewport} from 'angular2/src/core/annotations/annotations';
|
|
import {ViewContainer} from 'angular2/src/core/compiler/view_container';
|
|
import {isBlank} from 'angular2/src/facade/lang';
|
|
|
|
/**
|
|
* The `If` directive removes or recreates a portion of the DOM tree based on an {expression}. If
|
|
* the expression assigned to `if` evaluates to a false value then the element is removed from the
|
|
* DOM, otherwise a clone of the element is reinserted into the DOM.
|
|
*
|
|
* # Example:
|
|
*
|
|
* ```
|
|
* <div *if="errorCount > 0" class="error">
|
|
* <!-- Error message displayed when the errorCount property on the current context is greater than 0. -->
|
|
* {{errorCount}} errors detected
|
|
* </div>
|
|
* ```
|
|
*
|
|
* # Syntax
|
|
*
|
|
* - `<div *if="condition">...</div>`
|
|
* - `<div template="if condition">...</div>`
|
|
* - `<template [if]="condition"><div>...</div></template>`
|
|
*
|
|
* @exportedAs angular2/directives
|
|
*/
|
|
@Viewport({
|
|
selector: '[if]',
|
|
properties: {
|
|
'condition': 'if'
|
|
}
|
|
})
|
|
export class If {
|
|
viewContainer: ViewContainer;
|
|
prevCondition: boolean;
|
|
|
|
constructor(viewContainer: ViewContainer) {
|
|
this.viewContainer = viewContainer;
|
|
this.prevCondition = null;
|
|
}
|
|
|
|
set condition(newCondition) {
|
|
if (newCondition && (isBlank(this.prevCondition) || !this.prevCondition)) {
|
|
this.prevCondition = true;
|
|
this.viewContainer.create();
|
|
} else if (!newCondition && (isBlank(this.prevCondition) || this.prevCondition)) {
|
|
this.prevCondition = false;
|
|
this.viewContainer.clear();
|
|
}
|
|
}
|
|
}
|