相关疑难解决方法(0)

angularJS $ compile未定义

我正在尝试学习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

9
推荐指数
2
解决办法
2万
查看次数

标签 统计

angularjs ×1