Anularjs $compile throws exception

Why this throws an exception?

var item = {ID: 2, Name: "Andrej" };
var html = "<div>{{ID}} - {{Name}}</div>";
$compile(html)(item); // THIS THROWS EXCEPTION

Exception is (line 764)

TypeError: jqLite("<div>").append(element).html().match(/^(<[^>]+>)/) is null

If you just want to substitute values using the angular interpolator with an object, use $interpolate.

$compile is made for creating angularized elements, and requires a scope.

var item = {ID: 2, Name: "Andrej" };
var html = "<div>{{ID}} - {{Name}}</div>";
console.log($interpolate(html)(item)); // --> <div>2 - Andrej</div>