本文整理匯總了TypeScript中angular2/src/change_detection/parser/parser.Parser.parseInterpolation方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Parser.parseInterpolation方法的具體用法?TypeScript Parser.parseInterpolation怎麽用?TypeScript Parser.parseInterpolation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類angular2/src/change_detection/parser/parser.Parser
的用法示例。
在下文中一共展示了Parser.parseInterpolation方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: it
it("should support interpolation", () => {
var parser = new Parser(new Lexer());
var pcd = createProtoChangeDetector();
var ast = parser.parseInterpolation("B{{a}}A", "location");
var cd = instantiate(pcd, dispatcher, [new BindingRecord(ast, "memo", null)]);
cd.hydrate(new TestData("value"), null);
cd.detectChanges();
expect(dispatcher.log).toEqual(["memo=BvalueA"]);
});
示例2: _deserializeASTWithSource
private _deserializeASTWithSource(obj: StringMap<string, any>, data: string): AST {
// TODO: make ASTs serializable
var ast: AST;
switch (data) {
case "action":
ast = this._parser.parseAction(obj['input'], obj['location']);
break;
case "binding":
ast = this._parser.parseBinding(obj['input'], obj['location']);
break;
case "interpolation":
ast = this._parser.parseInterpolation(obj['input'], obj['location']);
break;
default:
throw "No AST deserializer for " + data;
}
return ast;
}