Throw error when compiling multiple roots

Closes #338
This commit is contained in:
Misko Hevery
2011-05-06 13:29:51 -07:00
parent f9f95879f0
commit 04a62e83bc
4 changed files with 17 additions and 3 deletions

View File

@@ -191,6 +191,11 @@ Compiler.prototype = {
var index = 0,
template,
parent = templateElement.parent();
if (templateElement.length > 1) {
// https://github.com/angular/angular.js/issues/338
throw Error("Cannot compile multiple element roots: " +
jqLite('<div>').append(templateElement.clone()).html());
}
if (parent && parent[0]) {
parent = parent[0];
for(var i = 0; i < parent.childNodes.length; i++) {