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

@ -32,12 +32,13 @@ export class RuntimeMetadataResolver {
var meta = this._cache.get(directiveType);
if (isBlank(meta)) {
var dirMeta = this._directiveResolver.resolve(directiveType);
var moduleUrl = calcModuleUrl(directiveType, dirMeta);
var moduleUrl = null;
var templateMeta = null;
var changeDetectionStrategy = null;
if (dirMeta instanceof md.ComponentMetadata) {
var cmpMeta = <md.ComponentMetadata>dirMeta;
moduleUrl = calcModuleUrl(directiveType, cmpMeta);
var viewMeta = this._viewResolver.resolve(directiveType);
templateMeta = new cpl.CompileTemplateMetadata({
encapsulation: viewMeta.encapsulation,
@ -107,8 +108,8 @@ function isValidDirective(value: Type): boolean {
return isPresent(value) && (value instanceof Type);
}
function calcModuleUrl(type: Type, dirMeta: md.DirectiveMetadata): string {
var moduleId = dirMeta.moduleId;
function calcModuleUrl(type: Type, cmpMetadata: md.ComponentMetadata): string {
var moduleId = cmpMetadata.moduleId;
if (isPresent(moduleId)) {
var scheme = getUrlScheme(moduleId);
return isPresent(scheme) && scheme.length > 0 ? moduleId :