Depends on #503
HTML Templates contain expressions and statements. These need to be extracted so that we can generate getters and setter stubs (in subsequent iteration we can generate ChangeDetection classes which are more efficient #502)
Given HTML such as:
{{list.name}}
<ul>
<li template="for: var i in items">{{item.description}}</li>
</ul>
Should generate these getters:
reflector.registerGetter({
"list": (o) => o.list,
"name": (o) => o.name,
"items": (o) => o.items,
"item": (o) => o.item,
"description": (o) => o.description,
});
Angular already has a parser which can extract all of the getters from the template. The parser is part of the Angular Compiler. Which consumes template and generates ProtoView. The ProtoView contains ProtoChangeDetector which in turn contains ProtoRecord. The ProtoRecord contains name field which corresponds to the getter.
The transformer needs to pass the template through the compiler and then iterate over the ProtoRecords to collect all of the getters.
NOTE: The compiler works on DOM API. In order to execute outside the browser we need to create DOM facade so that it can execute in the transformer. See #503.
NOTE: The above example does not have type information added, but such information can be extracted and added in subsequent improvements.
Depends on #503
HTML Templates contain expressions and statements. These need to be extracted so that we can generate getters and setter stubs (in subsequent iteration we can generate ChangeDetection classes which are more efficient #502)
Given HTML such as:
Should generate these getters:
Angular already has a parser which can extract all of the getters from the template. The parser is part of the Angular
Compiler. Which consumes template and generatesProtoView. TheProtoViewcontainsProtoChangeDetectorwhich in turn containsProtoRecord. TheProtoRecordcontainsnamefield which corresponds to the getter.The transformer needs to pass the template through the compiler and then iterate over the
ProtoRecords to collect all of the getters.NOTE: The compiler works on DOM API. In order to execute outside the browser we need to create DOM facade so that it can execute in the transformer. See #503.
NOTE: The above example does not have type information added, but such information can be extracted and added in subsequent improvements.