[IMP] qweb: add option to allow duplicate templates

This commit is contained in:
Géry Debongnie
2019-06-24 22:41:02 +02:00
parent 34695883c2
commit 4a889b7b6b
3 changed files with 16 additions and 6 deletions
+3 -1
View File
@@ -95,12 +95,14 @@ It's API is quite simple:
const qweb = new owl.QWeb(TEMPLATES);
```
- **`addTemplate(name, xmlStr)`**: add a specific template.
- **`addTemplate(name, xmlStr, allowDuplicate)`**: add a specific template.
```js
qweb.addTemplate("mytemplate", "<div>hello</div>");
```
If the optional `allowDuplicate` is set to `true`, then `QWeb` will simply return whenever a template is added for a second time. Otherwise, `QWeb` will crash.
- **`addTemplates(xmlStr)`**: add a list of templates (identified by `t-name`
attribute).