Revert "docs: test doc for decorator templates (#23902)"
This reverts commit 3938a8be75240a9a59dae9f2c999e936b98de429.
This commit is contained in:
parent
3938a8be75
commit
2056e1f05c
@ -19,13 +19,12 @@ import {BrowserXhr, HttpXhrBackend, XhrFactory} from './xhr';
|
|||||||
import {HttpXsrfCookieExtractor, HttpXsrfInterceptor, HttpXsrfTokenExtractor, XSRF_COOKIE_NAME, XSRF_HEADER_NAME} from './xsrf';
|
import {HttpXsrfCookieExtractor, HttpXsrfInterceptor, HttpXsrfTokenExtractor, XSRF_COOKIE_NAME, XSRF_HEADER_NAME} from './xsrf';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An injectable `HttpHandler` that applies multiple interceptors
|
* An `HttpHandler` that applies a bunch of `HttpInterceptor`s
|
||||||
* to a request before passing it to the given `HttpBackend`.
|
* to a request before passing it to the given `HttpBackend`.
|
||||||
*
|
*
|
||||||
* The interceptors are loaded lazily from the injector, to allow
|
* The interceptors are loaded lazily from the injector, to allow
|
||||||
* interceptors to themselves inject classes depending indirectly
|
* interceptors to themselves inject classes depending indirectly
|
||||||
* on `HttpInterceptingHandler` itself.
|
* on `HttpInterceptingHandler` itself.
|
||||||
* @see `HttpInterceptor`
|
|
||||||
*/
|
*/
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class HttpInterceptingHandler implements HttpHandler {
|
export class HttpInterceptingHandler implements HttpHandler {
|
||||||
@ -43,23 +42,6 @@ export class HttpInterceptingHandler implements HttpHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs an `HttpHandler` that applies interceptors
|
|
||||||
* to a request before passing it to the given `HttpBackend`.
|
|
||||||
*
|
|
||||||
* Use as a factory function within `HttpClientModule`.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
export function interceptingHandler(
|
|
||||||
backend: HttpBackend, interceptors: HttpInterceptor[] | null = []): HttpHandler {
|
|
||||||
if (!interceptors) {
|
|
||||||
return backend;
|
|
||||||
}
|
|
||||||
return interceptors.reduceRight(
|
|
||||||
(next, interceptor) => new HttpInterceptorHandler(next, interceptor), backend);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Factory function that determines where to store JSONP callbacks.
|
* Factory function that determines where to store JSONP callbacks.
|
||||||
*
|
*
|
||||||
@ -76,14 +58,14 @@ export function jsonpCallbackContext(): Object {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An NgModule that adds XSRF protection support to outgoing requests.
|
* `NgModule` which adds XSRF protection support to outgoing requests.
|
||||||
*
|
*
|
||||||
* For a server that supports a cookie-based XSRF protection system,
|
* Provided the server supports a cookie-based XSRF protection system, this
|
||||||
* use directly to configure XSRF protection with the correct
|
* module can be used directly to configure XSRF protection with the correct
|
||||||
* cookie and header names.
|
* cookie and header names.
|
||||||
*
|
*
|
||||||
* If no names are supplied, the default cookie name is `XSRF-TOKEN`
|
* If no such names are provided, the default is to use `X-XSRF-TOKEN` for
|
||||||
* and the default header name is `X-XSRF-TOKEN`.
|
* the header name and `XSRF-TOKEN` for the cookie name.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -110,12 +92,8 @@ export class HttpClientXsrfModule {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configure XSRF protection.
|
* Configure XSRF protection to use the given cookie name or header name,
|
||||||
* @param options An object that can specify either or both
|
* or the default names (as described above) if not provided.
|
||||||
* cookie name or header name.
|
|
||||||
* - Cookie name default is `XSRF-TOKEN`.
|
|
||||||
* - Header name default is `X-XSRF-TOKEN`.
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
static withOptions(options: {
|
static withOptions(options: {
|
||||||
cookieName?: string,
|
cookieName?: string,
|
||||||
@ -132,7 +110,7 @@ export class HttpClientXsrfModule {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An NgModule that provides the `HttpClient` and associated services.
|
* `NgModule` which provides the `HttpClient` and associated services.
|
||||||
*
|
*
|
||||||
* Interceptors can be added to the chain behind `HttpClient` by binding them
|
* Interceptors can be added to the chain behind `HttpClient` by binding them
|
||||||
* to the multiprovider for `HTTP_INTERCEPTORS`.
|
* to the multiprovider for `HTTP_INTERCEPTORS`.
|
||||||
@ -140,18 +118,12 @@ export class HttpClientXsrfModule {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@NgModule({
|
@NgModule({
|
||||||
/**
|
|
||||||
* Optional configuration for XSRF protection.
|
|
||||||
*/
|
|
||||||
imports: [
|
imports: [
|
||||||
HttpClientXsrfModule.withOptions({
|
HttpClientXsrfModule.withOptions({
|
||||||
cookieName: 'XSRF-TOKEN',
|
cookieName: 'XSRF-TOKEN',
|
||||||
headerName: 'X-XSRF-TOKEN',
|
headerName: 'X-XSRF-TOKEN',
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
/**
|
|
||||||
* The module provides `HttpClient` itself, and supporting services.
|
|
||||||
*/
|
|
||||||
providers: [
|
providers: [
|
||||||
HttpClient,
|
HttpClient,
|
||||||
{provide: HttpHandler, useClass: HttpInterceptingHandler},
|
{provide: HttpHandler, useClass: HttpInterceptingHandler},
|
||||||
@ -165,7 +137,7 @@ export class HttpClientModule {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An NgModule that enables JSONP support in `HttpClient`.
|
* `NgModule` which enables JSONP support in `HttpClient`.
|
||||||
*
|
*
|
||||||
* Without this module, Jsonp requests will reach the backend
|
* Without this module, Jsonp requests will reach the backend
|
||||||
* with method JSONP, where they'll be rejected.
|
* with method JSONP, where they'll be rejected.
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -14,7 +14,7 @@ import {TypeDecorator, makeDecorator} from '../util/decorators';
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A wrapper around an NgModule that associates it with the providers.
|
* A wrapper around a module that also includes the providers.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -24,21 +24,17 @@ export interface ModuleWithProviders {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A schema definition associated with an NgModule.
|
* Interface for schema definitions in @NgModules.
|
||||||
*
|
|
||||||
* @see `@NgModule`, `CUSTOM_ELEMENTS_SCHEMA`, `NO_ERRORS_SCHEMA`
|
|
||||||
*
|
|
||||||
* @param name The name of a defined schema.
|
|
||||||
*
|
*
|
||||||
* @experimental
|
* @experimental
|
||||||
*/
|
*/
|
||||||
export interface SchemaMetadata { name: string; }
|
export interface SchemaMetadata { name: string; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines a schema that allows an NgModule to contain the following:
|
* Defines a schema that will allow:
|
||||||
* - Non-Angular elements named with dash case (`-`).
|
* - any non-Angular elements with a `-` in their name,
|
||||||
* - Element properties named with dash case (`-`).
|
* - any properties on elements with a `-` in their name which is the common rule for custom
|
||||||
* Dash case is the naming convention for custom elements.
|
* elements.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -47,7 +43,7 @@ export const CUSTOM_ELEMENTS_SCHEMA: SchemaMetadata = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines a schema that allows any property on any element.
|
* Defines a schema that will allow any property on any element.
|
||||||
*
|
*
|
||||||
* @experimental
|
* @experimental
|
||||||
*/
|
*/
|
||||||
@ -63,7 +59,7 @@ export const NO_ERRORS_SCHEMA: SchemaMetadata = {
|
|||||||
*/
|
*/
|
||||||
export interface NgModuleDecorator {
|
export interface NgModuleDecorator {
|
||||||
/**
|
/**
|
||||||
* Marks a class as an NgModule and supplies configuration metadata.
|
* Defines an NgModule.
|
||||||
*/
|
*/
|
||||||
(obj?: NgModule): TypeDecorator;
|
(obj?: NgModule): TypeDecorator;
|
||||||
new (obj?: NgModule): NgModule;
|
new (obj?: NgModule): NgModule;
|
||||||
@ -76,13 +72,12 @@ export interface NgModuleDecorator {
|
|||||||
*/
|
*/
|
||||||
export interface NgModule {
|
export interface NgModule {
|
||||||
/**
|
/**
|
||||||
* The set of injectable objects that are available in the injector
|
* Defines the set of injectable objects that are available in the injector
|
||||||
* of this module.
|
* of this module.
|
||||||
*
|
*
|
||||||
* @usageNotes
|
* ## Simple Example
|
||||||
*
|
*
|
||||||
* The following example defines a class that is injected in
|
* Here is an example of a class that can be injected:
|
||||||
* the HelloWorld NgModule:
|
|
||||||
*
|
*
|
||||||
* ```
|
* ```
|
||||||
* class Greeter {
|
* class Greeter {
|
||||||
@ -108,12 +103,9 @@ export interface NgModule {
|
|||||||
providers?: Provider[];
|
providers?: Provider[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The set of directives and pipes that belong to this module.
|
* Specifies a list of directives/pipes that belong to this module.
|
||||||
*
|
*
|
||||||
* @usageNotes
|
* ### Example
|
||||||
*
|
|
||||||
* The following example allows the CommonModule to use the `NgFor`
|
|
||||||
* directive.
|
|
||||||
*
|
*
|
||||||
* ```javascript
|
* ```javascript
|
||||||
* @NgModule({
|
* @NgModule({
|
||||||
@ -126,13 +118,11 @@ export interface NgModule {
|
|||||||
declarations?: Array<Type<any>|any[]>;
|
declarations?: Array<Type<any>|any[]>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The set of NgModules, with or without providers,
|
* Specifies a list of modules whose exported directives/pipes
|
||||||
* whose exported directives/pipes
|
* should be available to templates in this module.
|
||||||
* are available to templates in this module.
|
* This can also contain {@link ModuleWithProviders}.
|
||||||
*
|
*
|
||||||
* @usageNotes
|
* ### Example
|
||||||
*
|
|
||||||
* The following example allows MainModule to use CommonModule:
|
|
||||||
*
|
*
|
||||||
* ```javascript
|
* ```javascript
|
||||||
* @NgModule({
|
* @NgModule({
|
||||||
@ -141,18 +131,15 @@ export interface NgModule {
|
|||||||
* class MainModule {
|
* class MainModule {
|
||||||
* }
|
* }
|
||||||
* ```
|
* ```
|
||||||
* @see {@link ModuleWithProviders}
|
|
||||||
*/
|
*/
|
||||||
imports?: Array<Type<any>|ModuleWithProviders|any[]>;
|
imports?: Array<Type<any>|ModuleWithProviders|any[]>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The set of directives, pipe, and NgModules that can be used
|
* Specifies a list of directives/pipes/modules that can be used within the template
|
||||||
* within the template of any component that is part of an
|
* of any component that is part of an Angular module
|
||||||
* NgModule that imports this NgModule.
|
* that imports this Angular module.
|
||||||
*
|
*
|
||||||
* @usageNotes
|
* ### Example
|
||||||
*
|
|
||||||
* The following example exports the `NgFor` directive from CommonModule.
|
|
||||||
*
|
*
|
||||||
* ```javascript
|
* ```javascript
|
||||||
* @NgModule({
|
* @NgModule({
|
||||||
@ -165,40 +152,45 @@ export interface NgModule {
|
|||||||
exports?: Array<Type<any>|any[]>;
|
exports?: Array<Type<any>|any[]>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The set of components to compile when this NgModule is defined.
|
* Specifies a list of components that should be compiled when this module is defined.
|
||||||
* For each component listed here, Angular creates a `ComponentFactory`
|
* For each component listed here, Angular will create a {@link ComponentFactory}
|
||||||
* and stores it in the `ComponentFactoryResolver`.
|
* and store it in the {@link ComponentFactoryResolver}.
|
||||||
*/
|
*/
|
||||||
entryComponents?: Array<Type<any>|any[]>;
|
entryComponents?: Array<Type<any>|any[]>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The set of components that are bootstrapped when
|
* Defines the components that should be bootstrapped when
|
||||||
* this module is bootstrapped. The components listed here
|
* this module is bootstrapped. The components listed here
|
||||||
* are automatically added to `entryComponents`.
|
* will automatically be added to `entryComponents`.
|
||||||
*/
|
*/
|
||||||
bootstrap?: Array<Type<any>|any[]>;
|
bootstrap?: Array<Type<any>|any[]>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The set of schemas that declare elements to be allowed in the NgModule.
|
* Elements and properties that are not Angular components nor directives have to be declared in
|
||||||
* Elements and properties that are neither Angular components nor directives
|
* the schema.
|
||||||
* must be declared in a schema.
|
|
||||||
*
|
*
|
||||||
* Allowed value are `NO_ERRORS_SCHEMA` and `CUSTOM_ELEMENTS_SCHEMA`.
|
* Available schemas:
|
||||||
|
* - `NO_ERRORS_SCHEMA`: any elements and properties are allowed,
|
||||||
|
* - `CUSTOM_ELEMENTS_SCHEMA`: any custom elements (tag name has "-") with any properties are
|
||||||
|
* allowed.
|
||||||
*
|
*
|
||||||
* @security When using one of `NO_ERRORS_SCHEMA` or `CUSTOM_ELEMENTS_SCHEMA`
|
* @security When using one of `NO_ERRORS_SCHEMA` or `CUSTOM_ELEMENTS_SCHEMA` we're trusting that
|
||||||
* you must ensure that allowed elements and properties securely escape inputs.
|
* allowed elements (and its properties) securely escape inputs.
|
||||||
*/
|
*/
|
||||||
schemas?: Array<SchemaMetadata|any[]>;
|
schemas?: Array<SchemaMetadata|any[]>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A name or path that uniquely identifies this NgModule in `getModuleFactory`.
|
* An opaque ID for this module, e.g. a name or a path. Used to identify modules in
|
||||||
* If left `undefined`, the NgModule is not registered with
|
* `getModuleFactory`. If left `undefined`, the `NgModule` will not be registered with
|
||||||
* `getModuleFactory`.
|
* `getModuleFactory`.
|
||||||
*/
|
*/
|
||||||
id?: string;
|
id?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* NgModule decorator and metadata.
|
||||||
|
*
|
||||||
|
*
|
||||||
* @Annotation
|
* @Annotation
|
||||||
*/
|
*/
|
||||||
export const NgModule: NgModuleDecorator = makeDecorator(
|
export const NgModule: NgModuleDecorator = makeDecorator(
|
||||||
@ -215,8 +207,3 @@ export const NgModule: NgModuleDecorator = makeDecorator(
|
|||||||
imports: imports,
|
imports: imports,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
/**
|
|
||||||
* Decorator that marks the following class as an NgModule, and supplies
|
|
||||||
* configuration metadata for it.
|
|
||||||
*/
|
|
||||||
(type: Type<any>, meta: NgModule) => (R3_COMPILE_NGMODULE || preR3NgModuleCompile)(type, meta));
|
|
||||||
|
@ -1,66 +0,0 @@
|
|||||||
/**
|
|
||||||
* @license
|
|
||||||
* Copyright Google Inc. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Use of this source code is governed by an MIT-style license that can be
|
|
||||||
* found in the LICENSE file at https://angular.io/license
|
|
||||||
*/
|
|
||||||
/* tslint:disable:no-console */
|
|
||||||
import {Component, Directive, EventEmitter} from '@angular/core';
|
|
||||||
|
|
||||||
// #docregion component-input
|
|
||||||
@Component({
|
|
||||||
selector: 'app-bank-account',
|
|
||||||
inputs: ['bankName', 'id: account-id'],
|
|
||||||
template: `
|
|
||||||
Bank Name: {{ bankName }}
|
|
||||||
Account Id: {{ id }}
|
|
||||||
`
|
|
||||||
})
|
|
||||||
export class BankAccountComponent {
|
|
||||||
bankName: string;
|
|
||||||
id: string;
|
|
||||||
|
|
||||||
// this property is not bound, and won't be automatically updated by Angular
|
|
||||||
normalizedBankName: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'app-my-input',
|
|
||||||
template: `
|
|
||||||
<app-bank-account
|
|
||||||
bankName="RBC"
|
|
||||||
account-id="4747">
|
|
||||||
</app-bank-account>
|
|
||||||
`
|
|
||||||
})
|
|
||||||
export class MyInputComponent {
|
|
||||||
}
|
|
||||||
// #enddocregion component-input
|
|
||||||
|
|
||||||
// #docregion component-output-interval
|
|
||||||
@Directive({selector: 'app-interval-dir', outputs: ['everySecond', 'fiveSecs: everyFiveSeconds']})
|
|
||||||
export class IntervalDirComponent {
|
|
||||||
everySecond = new EventEmitter<string>();
|
|
||||||
fiveSecs = new EventEmitter<string>();
|
|
||||||
|
|
||||||
constructor() {
|
|
||||||
setInterval(() => this.everySecond.emit('event'), 1000);
|
|
||||||
setInterval(() => this.fiveSecs.emit('event'), 5000);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'app-my-output',
|
|
||||||
template: `
|
|
||||||
<app-interval-dir
|
|
||||||
(everySecond)="onEverySecond()"
|
|
||||||
(everyFiveSeconds)="onEveryFiveSeconds()">
|
|
||||||
</app-interval-dir>
|
|
||||||
`
|
|
||||||
})
|
|
||||||
export class MyOutputComponent {
|
|
||||||
onEverySecond() { console.log('second'); }
|
|
||||||
onEveryFiveSeconds() { console.log('five seconds'); }
|
|
||||||
}
|
|
||||||
// #enddocregion component-output-interval
|
|
Loading…
x
Reference in New Issue
Block a user