diff --git a/public/_includes/_scripts-include.jade b/public/_includes/_scripts-include.jade index adc7bab4cb..9fa737e688 100644 --- a/public/_includes/_scripts-include.jade +++ b/public/_includes/_scripts-include.jade @@ -1,13 +1,16 @@ + +script(src="/resources/js/vendor/prettify.js") +script(src="/resources/js/vendor/lang-basic.js") +script(src="/resources/js/vendor/lang-dart.js") +script(src="/resources/js/vendor/jquery.js") + + script(src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.6/angular.js") script(src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.6/angular-animate.js") script(src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.6/angular-aria.js") script(src="https://ajax.googleapis.com/ajax/libs/angular_material/0.8.2/angular-material.min.js") - -script(src="/resources/js/vendor/prettify.js") -script(src="/resources/js/vendor/lang-basic.js") -script(src="/resources/js/vendor/lang-dart.js") script(src="/resources/js/site.js") diff --git a/public/docs/js/latest/api/_data.json b/public/docs/js/latest/api/_data.json deleted file mode 100644 index 0390cac11f..0000000000 --- a/public/docs/js/latest/api/_data.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "annotations": { - "title": "Annotations" - }, - - "change-detection": { - "title": "Change Detection" - } -} diff --git a/public/docs/js/latest/api/annotations/Ancestor-class.jade b/public/docs/js/latest/api/annotations/Ancestor-class.jade new file mode 100644 index 0000000000..cde8712e22 --- /dev/null +++ b/public/docs/js/latest/api/annotations/Ancestor-class.jade @@ -0,0 +1,74 @@ + +p. + exported from angular2/annotations + defined in angular2/src/core/annotations/visibility.js (line 105) + +:markdown + Specifies that an injector should retrieve a dependency from any ancestor element. + + An ancestor is any element between the parent element and shadow root. + + + ## Example + + Here is a simple directive that retrieves a dependency from an ancestor element. + + ``` + @Decorator({ + selector: '[dependency]', + properties: { + 'id':'dependency' + } + }) + class Dependency { + id:string; + } + + + @Decorator({ + selector: '[my-directive]' + }) + class Dependency { + constructor(@Ancestor() dependency:Dependency) { + expect(dependency.id).toEqual(2); + }; + } + ``` + + We use this with the following HTML template: + + ``` +
+
+
+
+
+
+
+ ``` + + The `@Ancestor()` annotation in our constructor forces the injector to retrieve the dependency from the + nearest ancestor element: + - The current element `dependency="3"` is skipped because it is not an ancestor. + - Next parent has no directives `
` + - Next parent has the `Dependency` directive and so the dependency is satisfied. + + Angular injects `dependency=2`. + +.l-main-section + h2 Members + .l-sub-section + h3 constructor + + + pre.prettyprint + code. + () + + + + :markdown + + + + diff --git a/public/docs/js/latest/api/annotations/Attribute-class.jade b/public/docs/js/latest/api/annotations/Attribute-class.jade new file mode 100644 index 0000000000..38e5211bdd --- /dev/null +++ b/public/docs/js/latest/api/annotations/Attribute-class.jade @@ -0,0 +1,72 @@ + +p. + exported from angular2/annotations + defined in angular2/src/core/annotations/di.js (line 53) + +:markdown + Specifies that a constant attribute value should be injected. + + The directive can inject constant string literals of host element attributes. + + ## Example + + Suppose we have an `` element and want to know its `type`. + + ```html + + ``` + + A decorator can inject string literal `text` like so: + + ```javascript + @Decorator({ + selector: `input' + }) + class InputDecorator { + constructor(@Attribute('type') type) { + // type would be `text` in this example + } + } + ``` + +.l-main-section + h2 Members + .l-sub-section + h3 constructor + + + pre.prettyprint + code. + (attributeName) + + + + :markdown + + + + + + .l-sub-section + h3 attributeName + + + + :markdown + + + + + + + .l-sub-section + h3 token + + + + :markdown + + + + + diff --git a/public/docs/js/latest/api/annotations/Decorator-class.jade b/public/docs/js/latest/api/annotations/Decorator-class.jade new file mode 100644 index 0000000000..c3826ebfac --- /dev/null +++ b/public/docs/js/latest/api/annotations/Decorator-class.jade @@ -0,0 +1,106 @@ + +p. + exported from angular2/annotations + defined in angular2/src/core/annotations/annotations.js (line 750) + +:markdown + Directive that attaches behavior to DOM elements. + + A decorator directive attaches behavior to a DOM element in a composable manner. + (see: http://en.wikipedia.org/wiki/Composition_over_inheritance) + + Decorators: + - are simplest form of [Directive]s. + - are best used as a composition pattern () + + Decorators differ from [Component]s in that they: + - can have multiple decorators per element + - do not create their own evaluation context + - do not have a template (and therefor do not create Shadow DOM) + + + ## Example + + Here we use a decorator directive to simply define basic tool-tip behavior. + + ``` + @Decorator({ + selector: '[tooltip]', + properties: { + 'text': 'tooltip' + }, + hostListeners: { + 'onmouseenter': 'onMouseEnter()', + 'onmouseleave': 'onMouseLeave()' + } + }) + class Tooltip{ + text:string; + overlay:Overlay; // NOT YET IMPLEMENTED + overlayManager:OverlayManager; // NOT YET IMPLEMENTED + + constructor(overlayManager:OverlayManager) { + this.overlay = overlay; + } + + onMouseEnter() { + // exact signature to be determined + this.overlay = this.overlayManager.open(text, ...); + } + + onMouseLeave() { + this.overlay.close(); + this.overlay = null; + } + } + ``` + In our HTML template, we can then add this behavior to a `
` or any other element with the `tooltip` selector, + like so: + + ``` +
+ ``` + +.l-main-section + h2 Members + .l-sub-section + h3 constructor + + + pre.prettyprint + code. + ({ + selector, + properties, + events, + hostListeners, + lifecycle, + compileChildren = true, + }:{ + selector:string, + properties:any, + events:List, + hostListeners:any, + lifecycle:List, + compileChildren:boolean + }={}) + + + + :markdown + + + + + + .l-sub-section + h3 compileChildren + + + + :markdown + If set to true the compiler does not compile the children of this directive. + + + + diff --git a/public/docs/js/latest/api/annotations/DynamicComponent-class.jade b/public/docs/js/latest/api/annotations/DynamicComponent-class.jade new file mode 100644 index 0000000000..64f2c8be4e --- /dev/null +++ b/public/docs/js/latest/api/annotations/DynamicComponent-class.jade @@ -0,0 +1,93 @@ + +p. + exported from angular2/annotations + defined in angular2/src/core/annotations/annotations.js (line 655) + +:markdown + Directive used for dynamically loading components. + + Regular Angular components are statically resolved. DynamicComponent allows to you resolve a component at runtime + instead by providing a placeholder into which a regular Angular component can be dynamically loaded. Once loaded, + the dynamically-loaded component becomes permanent and cannot be changed. + + + ## Example + + Here we have `DynamicComp` which acts as the placeholder for `HelloCmp`. At runtime, the dynamic component + `DynamicComp` requests loading of the `HelloCmp` component. + + There is nothing special about `HelloCmp`, which is a regular Angular component. It can also be used in other static + locations. + + ``` + @DynamicComponent({ + selector: 'dynamic-comp' + }) + class DynamicComp { + helloCmp:HelloCmp; + constructor(loader:DynamicComponentLoader, location:PrivateComponentLocation) { + loader.load(HelloCmp, location).then((helloCmp) => { + this.helloCmp = helloCmp; + }); + } + } + + @Component({ + selector: 'hello-cmp' + }) + @View({ + template: "{{greeting}}" + }) + class HelloCmp { + greeting:string; + constructor() { + this.greeting = "hello"; + } + } + ``` + + + +.l-main-section + h2 Members + .l-sub-section + h3 constructor + + + pre.prettyprint + code. + ({ + selector, + properties, + events, + hostListeners, + injectables, + lifecycle + }:{ + selector:string, + properties:Object, + events:List, + hostListeners:Object, + injectables:List, + lifecycle:List + }={}) + + + + :markdown + + + + + + .l-sub-section + h3 injectables + + + + :markdown + Same as [Component.injectables]. + + + + diff --git a/public/docs/js/latest/api/annotations/Parent-class.jade b/public/docs/js/latest/api/annotations/Parent-class.jade new file mode 100644 index 0000000000..2eaad1cac8 --- /dev/null +++ b/public/docs/js/latest/api/annotations/Parent-class.jade @@ -0,0 +1,61 @@ + +p. + exported from angular2/annotations + defined in angular2/src/core/annotations/visibility.js (line 44) + +:markdown + Specifies that an injector should retrieve a dependency from the direct parent. + + ## Example + + Here is a simple directive that retrieves a dependency from its parent element. + + ``` + @Decorator({ + selector: '[dependency]', + properties: { + 'id':'dependency' + } + }) + class Dependency { + id:string; + } + + + @Decorator({ + selector: '[my-directive]' + }) + class Dependency { + constructor(@Parent() dependency:Dependency) { + expect(dependency.id).toEqual(1); + }; + } + ``` + + We use this with the following HTML template: + + ``` +
+
+
+ ``` + The `@Parent()` annotation in our constructor forces the injector to retrieve the dependency from the + parent element (even thought the current element could resolve it): Angular injects `dependency=1`. + +.l-main-section + h2 Members + .l-sub-section + h3 constructor + + + pre.prettyprint + code. + () + + + + :markdown + + + + diff --git a/public/docs/js/latest/api/annotations/PropertySetter-class.jade b/public/docs/js/latest/api/annotations/PropertySetter-class.jade new file mode 100644 index 0000000000..cc3812d055 --- /dev/null +++ b/public/docs/js/latest/api/annotations/PropertySetter-class.jade @@ -0,0 +1,53 @@ + +p. + exported from angular2/annotations + defined in angular2/src/core/annotations/di.js (line 12) + +:markdown + Specifies that a function for setting host properties should be injected. + + NOTE: This is changing pre 1.0. + + The directive can inject a property setter that would allow setting this property on the host element. + +.l-main-section + h2 Members + .l-sub-section + h3 constructor + + + pre.prettyprint + code. + (propName) + + + + :markdown + + + + + + .l-sub-section + h3 propName + + + + :markdown + + + + + + + .l-sub-section + h3 token + + + + :markdown + + + + + diff --git a/public/docs/js/latest/api/annotations/Query-class.jade b/public/docs/js/latest/api/annotations/Query-class.jade new file mode 100644 index 0000000000..a80a868aeb --- /dev/null +++ b/public/docs/js/latest/api/annotations/Query-class.jade @@ -0,0 +1,39 @@ + +p. + exported from angular2/annotations + defined in angular2/src/core/annotations/di.js (line 77) + +:markdown + Specifies that a [QueryList] should be injected. + + See: [QueryList] for usage and example. + +.l-main-section + h2 Members + .l-sub-section + h3 constructor + + + pre.prettyprint + code. + (directive) + + + + :markdown + + + + + + .l-sub-section + h3 directive + + + + :markdown + + + + + diff --git a/public/docs/js/latest/api/annotations/View-class.jade b/public/docs/js/latest/api/annotations/View-class.jade new file mode 100644 index 0000000000..d901a2faf7 --- /dev/null +++ b/public/docs/js/latest/api/annotations/View-class.jade @@ -0,0 +1,119 @@ + +p. + exported from angular2/annotations + defined in angular2/src/core/annotations/view.js (line 34) + +:markdown + Declare the available HTML templates for an application. + + Each angular component requires a single `@Component` and at least one `@View` annotation. The @View + annotation specifies the HTML template to use, and lists the directives that are active within the template. + + When a component is instantiated, the template is loaded into the component's shadow root, and the + expressions and statements in the template are evaluated against the component. + + For details on the `@Component` annotation, see [Component]. + + ## Example + + ``` + @Component({ + selector: 'greet' + }) + @View({ + template: 'Hello {{name}}!', + directives: [GreetUser, Bold] + }) + class Greet { + name: string; + + constructor() { + this.name = 'World'; + } + } + ``` + +.l-main-section + h2 Members + .l-sub-section + h3 constructor + + + pre.prettyprint + code. + ({ + templateUrl, + template, + directives + }: { + templateUrl: string, + template: string, + directives: List<Type> + }) + + + + :markdown + + + + + + .l-sub-section + h3 directives + + + + :markdown + Specify a list of directives that are active within a template. [TODO: true?] + + Directives must be listed explicitly to provide proper component encapsulation. + + + + ```javascript + @Component({ + selector: 'my-component' + }) + @View({ + directives: [For] + template: ' + ' + }) + class MyComponent { + } + ``` + + + + + + .l-sub-section + h3 template + + + + :markdown + Specify an inline template for an angular component. + + NOTE: either `templateURL` or `template` should be used, but not both. + + + + + + .l-sub-section + h3 templateUrl + + + + :markdown + Specify a template URL for an angular component. + + NOTE: either `templateURL` or `template` should be used, but not both. + + + + diff --git a/public/docs/js/latest/api/annotations/Viewport-class.jade b/public/docs/js/latest/api/annotations/Viewport-class.jade new file mode 100644 index 0000000000..b5062fb744 --- /dev/null +++ b/public/docs/js/latest/api/annotations/Viewport-class.jade @@ -0,0 +1,124 @@ + +p. + exported from angular2/annotations + defined in angular2/src/core/annotations/annotations.js (line 879) + +:markdown + Directive that controls the instantiation, destruction, and positioning of inline template elements. + + A viewport directive uses a [ViewContainer] to instantiate, insert, move, and destroy views at runtime. + The [ViewContainer] is created as a result of `