我正在尝试学习AngularJS,我正在尝试动态编译一些DOM元素......我尝试过这个演示:
try {
var templateHTML = angular.element('<p>{{total}}</p>'),
scope = ....;
var clonedElement = $compile(templateHTML)(scope, function(clonedElement, scope) {
//attach the clone to DOM document at the right place
});
//now we have reference to the cloned DOM via `clone`
} catch (ex) {
alert(ex.message);
}
Run Code Online (Sandbox Code Playgroud)
但我得到的只是"$ compile未定义"
救命!
angularjs ×1