-
Notifications
You must be signed in to change notification settings - Fork 24.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(compiler_cli): allow to use builtin directives like
NgIf
, …
- Loading branch information
Showing
14 changed files
with
130 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<div>{{ctxProp}}</div> | ||
<form><input type="button" [(ngModel)]="ctxProp"/></form> | ||
<my-comp></my-comp> | ||
<my-comp *ngIf="ctxBool"></my-comp> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,16 @@ | ||
import {Component, Inject} from '@angular/core'; | ||
import {FORM_DIRECTIVES} from '@angular/common'; | ||
import {FORM_DIRECTIVES, NgIf} from '@angular/common'; | ||
import {MyComp} from './a/multiple_components'; | ||
|
||
@Component({ | ||
selector: 'basic', | ||
templateUrl: './basic.html', | ||
styles: ['.red { color: red }'], | ||
styleUrls: ['./basic.css'], | ||
directives: [MyComp, FORM_DIRECTIVES] | ||
directives: [MyComp, FORM_DIRECTIVES, NgIf] | ||
}) | ||
export class Basic { | ||
ctxProp: string; | ||
constructor() { this.ctxProp = 'initiaValue'; } | ||
ctxBool: boolean; | ||
constructor() { this.ctxProp = 'initialValue'; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
modules/@angular/compiler_cli/src/static_reflection_capabilities.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import {reflector} from '@angular/core'; | ||
import {ReflectionCapabilities} from './core_private'; | ||
import {StaticReflector} from './static_reflector'; | ||
|
||
export class StaticAndDynamicReflectionCapabilities { | ||
static install(staticDelegate: StaticReflector) { | ||
reflector.updateCapabilities(new StaticAndDynamicReflectionCapabilities(staticDelegate)); | ||
} | ||
|
||
private dynamicDelegate = new ReflectionCapabilities(); | ||
|
||
constructor(private staticDelegate: StaticReflector) {} | ||
|
||
isReflectionEnabled(): boolean { | ||
return true; | ||
} | ||
factory(type: any): Function { | ||
return this.dynamicDelegate.factory(type); | ||
} | ||
interfaces(type: any): any[] { | ||
return this.dynamicDelegate.interfaces(type); | ||
} | ||
parameters(type: any): any[][] { | ||
return isStaticType(type) ? this.staticDelegate.parameters(type) : this.dynamicDelegate.parameters(type); | ||
} | ||
annotations(type: any): any[] { | ||
return isStaticType(type) ? this.staticDelegate.annotations(type) : this.dynamicDelegate.annotations(type); | ||
} | ||
propMetadata(typeOrFunc: any): {[key: string]: any[]} { | ||
return isStaticType(typeOrFunc) ? this.staticDelegate.propMetadata(typeOrFunc) : this.dynamicDelegate.propMetadata(typeOrFunc); | ||
} | ||
getter(name: string) { | ||
return this.dynamicDelegate.getter(name); | ||
} | ||
setter(name: string) { | ||
return this.dynamicDelegate.setter(name); | ||
} | ||
method(name: string) { | ||
return this.dynamicDelegate.method(name); | ||
} | ||
importUri(type: any): string { | ||
return this.staticDelegate.importUri(type); | ||
} | ||
} | ||
|
||
function isStaticType(type: any): boolean { | ||
return typeof type === 'object' && type.name && type.filePath; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters