refactor(chore): Replace all 'bindings' with 'providers'
BREAKING CHANGE Deprecated `bindings:` and `viewBindings:` are replaced with `providers:` and `viewProviders:` Closes #7687
This commit is contained in:

committed by
Misko Hevery

parent
49fb7ef421
commit
0795dd307b
@ -32,8 +32,6 @@ class Directive extends DirectiveMetadata {
|
||||
@Deprecated('Use `outputs` or `@Output` instead')
|
||||
List<String> events,
|
||||
Map<String, String> host,
|
||||
@Deprecated('Use `providers` instead')
|
||||
List bindings,
|
||||
List providers,
|
||||
String exportAs,
|
||||
Map<String, dynamic> queries})
|
||||
@ -44,7 +42,6 @@ class Directive extends DirectiveMetadata {
|
||||
properties: properties,
|
||||
events: events,
|
||||
host: host,
|
||||
bindings: bindings,
|
||||
providers: providers,
|
||||
exportAs: exportAs,
|
||||
queries: queries);
|
||||
@ -63,14 +60,10 @@ class Component extends ComponentMetadata {
|
||||
@Deprecated('Use `outputs` or `@Output` instead')
|
||||
List<String> events,
|
||||
Map<String, String> host,
|
||||
@Deprecated('Use `providers` instead')
|
||||
List bindings,
|
||||
List providers,
|
||||
String exportAs,
|
||||
String moduleId,
|
||||
Map<String, dynamic> queries,
|
||||
@Deprecated('Use `viewProviders` instead')
|
||||
List viewBindings,
|
||||
List viewProviders,
|
||||
ChangeDetectionStrategy changeDetection,
|
||||
String templateUrl,
|
||||
@ -87,11 +80,9 @@ class Component extends ComponentMetadata {
|
||||
properties: properties,
|
||||
events: events,
|
||||
host: host,
|
||||
bindings: bindings,
|
||||
providers: providers,
|
||||
exportAs: exportAs,
|
||||
moduleId: moduleId,
|
||||
viewBindings: viewBindings,
|
||||
viewProviders: viewProviders,
|
||||
queries: queries,
|
||||
changeDetection: changeDetection,
|
||||
|
@ -153,7 +153,6 @@ export interface DirectiveMetadataFactory {
|
||||
properties?: string[],
|
||||
events?: string[],
|
||||
host?: {[key: string]: string},
|
||||
bindings?: any[],
|
||||
providers?: any[],
|
||||
exportAs?: string,
|
||||
queries?: {[key: string]: any}
|
||||
@ -165,7 +164,6 @@ export interface DirectiveMetadataFactory {
|
||||
properties?: string[],
|
||||
events?: string[],
|
||||
host?: {[key: string]: string},
|
||||
bindings?: any[],
|
||||
providers?: any[],
|
||||
exportAs?: string,
|
||||
queries?: {[key: string]: any}
|
||||
@ -211,13 +209,10 @@ export interface ComponentMetadataFactory {
|
||||
properties?: string[],
|
||||
events?: string[],
|
||||
host?: {[key: string]: string},
|
||||
/* @deprecated */
|
||||
bindings?: any[],
|
||||
providers?: any[],
|
||||
exportAs?: string,
|
||||
moduleId?: string,
|
||||
queries?: {[key: string]: any},
|
||||
viewBindings?: any[],
|
||||
viewProviders?: any[],
|
||||
changeDetection?: ChangeDetectionStrategy,
|
||||
templateUrl?: string,
|
||||
@ -235,14 +230,10 @@ export interface ComponentMetadataFactory {
|
||||
properties?: string[],
|
||||
events?: string[],
|
||||
host?: {[key: string]: string},
|
||||
/* @deprecated */
|
||||
bindings?: any[],
|
||||
providers?: any[],
|
||||
exportAs?: string,
|
||||
moduleId?: string,
|
||||
queries?: {[key: string]: any},
|
||||
/* @deprecated */
|
||||
viewBindings?: any[],
|
||||
viewProviders?: any[],
|
||||
changeDetection?: ChangeDetectionStrategy,
|
||||
templateUrl?: string,
|
||||
|
@ -649,7 +649,7 @@ export class DirectiveMetadata extends InjectableMetadata {
|
||||
*
|
||||
* @Directive({
|
||||
* selector: 'greet',
|
||||
* bindings: [
|
||||
* providers: [
|
||||
* Greeter
|
||||
* ]
|
||||
* })
|
||||
@ -663,13 +663,9 @@ export class DirectiveMetadata extends InjectableMetadata {
|
||||
* ```
|
||||
*/
|
||||
get providers(): any[] {
|
||||
return isPresent(this._bindings) && this._bindings.length > 0 ? this._bindings :
|
||||
this._providers;
|
||||
return this._providers;
|
||||
}
|
||||
/** @deprecated */
|
||||
get bindings(): any[] { return this.providers; }
|
||||
private _providers: any[];
|
||||
private _bindings: any[];
|
||||
|
||||
/**
|
||||
* Defines the name that can be used in the template to assign this directive to a variable.
|
||||
@ -731,7 +727,7 @@ export class DirectiveMetadata extends InjectableMetadata {
|
||||
*/
|
||||
queries: {[key: string]: any};
|
||||
|
||||
constructor({selector, inputs, outputs, properties, events, host, bindings, providers, exportAs,
|
||||
constructor({selector, inputs, outputs, properties, events, host, providers, exportAs,
|
||||
queries}: {
|
||||
selector?: string,
|
||||
inputs?: string[],
|
||||
@ -740,7 +736,6 @@ export class DirectiveMetadata extends InjectableMetadata {
|
||||
events?: string[],
|
||||
host?: {[key: string]: string},
|
||||
providers?: any[],
|
||||
/** @deprecated */ bindings?: any[],
|
||||
exportAs?: string,
|
||||
queries?: {[key: string]: any}
|
||||
} = {}) {
|
||||
@ -754,7 +749,6 @@ export class DirectiveMetadata extends InjectableMetadata {
|
||||
this.exportAs = exportAs;
|
||||
this.queries = queries;
|
||||
this._providers = providers;
|
||||
this._bindings = bindings;
|
||||
}
|
||||
}
|
||||
|
||||
@ -836,12 +830,9 @@ export class ComponentMetadata extends DirectiveMetadata {
|
||||
* ```
|
||||
*/
|
||||
get viewProviders(): any[] {
|
||||
return isPresent(this._viewBindings) && this._viewBindings.length > 0 ? this._viewBindings :
|
||||
this._viewProviders;
|
||||
return this._viewProviders;
|
||||
}
|
||||
get viewBindings(): any[] { return this.viewProviders; }
|
||||
private _viewProviders: any[];
|
||||
private _viewBindings: any[];
|
||||
|
||||
/**
|
||||
* The module id of the module that contains the component.
|
||||
@ -877,8 +868,8 @@ export class ComponentMetadata extends DirectiveMetadata {
|
||||
|
||||
encapsulation: ViewEncapsulation;
|
||||
|
||||
constructor({selector, inputs, outputs, properties, events, host, exportAs, moduleId, bindings,
|
||||
providers, viewBindings, viewProviders,
|
||||
constructor({selector, inputs, outputs, properties, events, host, exportAs, moduleId,
|
||||
providers, viewProviders,
|
||||
changeDetection = ChangeDetectionStrategy.Default, queries, templateUrl, template,
|
||||
styleUrls, styles, directives, pipes, encapsulation}: {
|
||||
selector?: string,
|
||||
@ -887,11 +878,9 @@ export class ComponentMetadata extends DirectiveMetadata {
|
||||
properties?: string[],
|
||||
events?: string[],
|
||||
host?: {[key: string]: string},
|
||||
/** @deprecated */ bindings?: any[],
|
||||
providers?: any[],
|
||||
exportAs?: string,
|
||||
moduleId?: string,
|
||||
/** @deprecated */ viewBindings?: any[],
|
||||
viewProviders?: any[],
|
||||
queries?: {[key: string]: any},
|
||||
changeDetection?: ChangeDetectionStrategy,
|
||||
@ -911,14 +900,12 @@ export class ComponentMetadata extends DirectiveMetadata {
|
||||
events: events,
|
||||
host: host,
|
||||
exportAs: exportAs,
|
||||
bindings: bindings,
|
||||
providers: providers,
|
||||
queries: queries
|
||||
});
|
||||
|
||||
this.changeDetection = changeDetection;
|
||||
this._viewProviders = viewProviders;
|
||||
this._viewBindings = viewBindings;
|
||||
this.templateUrl = templateUrl;
|
||||
this.template = template;
|
||||
this.styleUrls = styleUrls;
|
||||
|
Reference in New Issue
Block a user