refactor(Directive): drop moduleId

moduleId is only used by components to resolve urls.
Directives have no templates and do not need moduleId.
Closes #5873
This commit is contained in:
Victor Berchet
2015-12-13 17:35:33 -08:00
parent 1c779d8b9e
commit 5a04ffec3e
9 changed files with 37 additions and 47 deletions

View File

@ -696,26 +696,6 @@ export class DirectiveMetadata extends InjectableMetadata {
*/
exportAs: string;
/**
* The module id of the module that contains the directive.
* Needed to be able to resolve relative urls for templates and styles.
* In Dart, this can be determined automatically and does not need to be set.
* In CommonJS, this can always be set to `module.id`.
*
* ## Simple Example
*
* ```
* @Directive({
* selector: 'someDir',
* moduleId: module.id
* })
* class SomeDir {
* }
*
* ```
*/
moduleId: string;
// TODO: add an example after ContentChildren and ViewChildren are in master
/**
* Configures the queries that will be injected into the directive.
@ -752,7 +732,7 @@ export class DirectiveMetadata extends InjectableMetadata {
queries: {[key: string]: any};
constructor({selector, inputs, outputs, properties, events, host, bindings, providers, exportAs,
moduleId, queries}: {
queries}: {
selector?: string,
inputs?: string[],
outputs?: string[],
@ -762,7 +742,6 @@ export class DirectiveMetadata extends InjectableMetadata {
providers?: any[],
/** @deprecated */ bindings?: any[],
exportAs?: string,
moduleId?: string,
queries?: {[key: string]: any}
} = {}) {
super();
@ -773,7 +752,6 @@ export class DirectiveMetadata extends InjectableMetadata {
this._events = events;
this.host = host;
this.exportAs = exportAs;
this.moduleId = moduleId;
this.queries = queries;
this._providers = providers;
this._bindings = bindings;
@ -865,6 +843,26 @@ export class ComponentMetadata extends DirectiveMetadata {
private _viewProviders: any[];
private _viewBindings: any[];
/**
* The module id of the module that contains the component.
* Needed to be able to resolve relative urls for templates and styles.
* In Dart, this can be determined automatically and does not need to be set.
* In CommonJS, this can always be set to `module.id`.
*
* ## Simple Example
*
* ```
* @Directive({
* selector: 'someDir',
* moduleId: module.id
* })
* class SomeDir {
* }
*
* ```
*/
moduleId: string;
templateUrl: string;
template: string;
@ -913,7 +911,6 @@ export class ComponentMetadata extends DirectiveMetadata {
events: events,
host: host,
exportAs: exportAs,
moduleId: moduleId,
bindings: bindings,
providers: providers,
queries: queries
@ -929,6 +926,7 @@ export class ComponentMetadata extends DirectiveMetadata {
this.directives = directives;
this.pipes = pipes;
this.encapsulation = encapsulation;
this.moduleId = moduleId;
}
}