diff --git a/js-libs/easysax/easysax.js b/js-libs/easysax/easysax.js
index 8d6a08719..7b6f7f10e 100644
--- a/js-libs/easysax/easysax.js
+++ b/js-libs/easysax/easysax.js
@@ -251,8 +251,8 @@ function EasySAXParser() {
continue
};
- if (w < 65 || w >122 || (w>90 && w<97) ) { // ожидаем символ
- //console.log('error attr 1')
+ if ((w < 65 && w !== 40 && w !== 41) || // allow parens () -- used for angular syntax
+ w > 122 || (w === 92 || (w > 93 && w < 97)) ) { // ожидаем символ
return attr_res = false; // error. invalid char
};
@@ -263,10 +263,14 @@ function EasySAXParser() {
continue;
};
- if (w===32 || (w > 8 && w<14) ) { // \f\n\r\t\v пробел
+ if (w === 32 || (w > 8 && w < 14) ) { // \f\n\r\t\v пробел
continue;
};
+ if (w === 91 || w === 93 || w === 40 || w === 41 || w === 94) { // Angular special attribute chars:[]()^
+ continue;
+ }
+
if (w !== 61) { // "=" == 61
//console.log('error 2');
diff --git a/node-tests/test-angular-xml.ts b/node-tests/test-angular-xml.ts
new file mode 100644
index 000000000..3c65eddd5
--- /dev/null
+++ b/node-tests/test-angular-xml.ts
@@ -0,0 +1,40 @@
+import {assert} from "chai";
+import xml = require('xml');
+
+describe("angular xml parser", () => {
+ let last_element = null;
+ let last_attrs = null;
+ let parser = null;
+
+ beforeEach(() => {
+ parser = new xml.XmlParser(function (event: xml.ParserEvent) {
+ switch (event.eventType) {
+ case xml.ParserEventType.StartElement:
+ last_element = event.elementName;
+ last_attrs = event.attributes;
+ break;
+ }
+ });
+ });
+
+ it("parses [property] binding", () => {
+ parser.parse("");
+
+ assert.equal('TextField', last_element);
+ assert.equal(last_attrs['[text]'], 'somevar');
+ });
+
+ it("parses (event) binding", () => {
+ parser.parse("");
+
+ assert.equal('TextField', last_element);
+ assert.equal(last_attrs['(tap)'], 'onTap(blah)');
+ });
+
+ it("parsers (^event) binding", () => {
+ parser.parse("");
+
+ assert.equal('TextField', last_element);
+ assert.equal(last_attrs['(^tap)'], 'onTap(blah)');
+ });
+});
diff --git a/node-tests/test-xml.ts b/node-tests/test-xml.ts
index e208c4f60..6d392a958 100644
--- a/node-tests/test-xml.ts
+++ b/node-tests/test-xml.ts
@@ -27,5 +27,4 @@ describe("xml parser", () => {
assert.equal('TextField', last_element);
assert.equal('hello', last_attrs['text']);
});
-
});
diff --git a/xml/xml.ts b/xml/xml.ts
index 2efd9efea..7cd8b2563 100644
--- a/xml/xml.ts
+++ b/xml/xml.ts
@@ -242,4 +242,4 @@ export class XmlParser implements definition.XmlParser {
return s;
}
-}
\ No newline at end of file
+}