feat(ng-repeat): initial implementaion of ng-repeat.
- adds support for content bindings via '[]'. - directives module
This commit is contained in:
@ -118,11 +118,16 @@ export class ElementBinderBuilder extends CompileStep {
|
||||
throw new BaseException('No element binding found for property '+elProp
|
||||
+' which is required by directive '+stringify(typeWithAnnotation.type));
|
||||
}
|
||||
var len = dirProp.length;
|
||||
var dirBindingName = dirProp;
|
||||
var isContentWatch = dirProp[len - 2] === '[' && dirProp[len - 1] === ']';
|
||||
if (isContentWatch) dirBindingName = dirProp.substring(0, len - 2);
|
||||
protoView.bindDirectiveProperty(
|
||||
directiveIndex++,
|
||||
expression,
|
||||
dirProp,
|
||||
reflector.setter(dirProp)
|
||||
dirBindingName,
|
||||
reflector.setter(dirBindingName),
|
||||
isContentWatch
|
||||
);
|
||||
});
|
||||
});
|
||||
|
@ -417,7 +417,8 @@ export class ProtoView {
|
||||
directiveIndex:number,
|
||||
expression:AST,
|
||||
setterName:string,
|
||||
setter:SetterFn) {
|
||||
setter:SetterFn,
|
||||
isContentWatch: boolean) {
|
||||
|
||||
var expMemento = new DirectivePropertyMemento(
|
||||
this.elementBinders.length-1,
|
||||
@ -426,7 +427,7 @@ export class ProtoView {
|
||||
setter
|
||||
);
|
||||
var groupMemento = DirectivePropertyGroupMemento.get(expMemento);
|
||||
this.protoRecordRange.addRecordsFromAST(expression, expMemento, groupMemento, false);
|
||||
this.protoRecordRange.addRecordsFromAST(expression, expMemento, groupMemento, isContentWatch);
|
||||
}
|
||||
|
||||
// Create a rootView as if the compiler encountered <rootcmp></rootcmp>,
|
||||
@ -500,7 +501,7 @@ class DirectivePropertyGroupMemento {
|
||||
var directiveIndex = memento._directiveIndex;
|
||||
var id = elementInjectorIndex * 100 + directiveIndex;
|
||||
|
||||
if (! MapWrapper.contains(_groups, id)) {
|
||||
if (!MapWrapper.contains(_groups, id)) {
|
||||
MapWrapper.set(_groups, id, new DirectivePropertyGroupMemento(elementInjectorIndex, directiveIndex));
|
||||
}
|
||||
return MapWrapper.get(_groups, id);
|
||||
|
@ -37,7 +37,11 @@ export class ViewPort {
|
||||
dehydrate() {
|
||||
this.appInjector = null;
|
||||
this.hostElementInjector = null;
|
||||
for (var i = 0; i < this._views.length; i++) {
|
||||
this.clear();
|
||||
}
|
||||
|
||||
clear() {
|
||||
for (var i = this._views.length - 1; i >= 0; i--) {
|
||||
this.remove(i);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user