Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/79.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 指令中带有ng include的jQuery组件_Javascript_Jquery_Angularjs_Angularjs Directive_Angularjs Ng Include - Fatal编程技术网

Javascript 指令中带有ng include的jQuery组件

Javascript 指令中带有ng include的jQuery组件,javascript,jquery,angularjs,angularjs-directive,angularjs-ng-include,Javascript,Jquery,Angularjs,Angularjs Directive,Angularjs Ng Include,我在angular中使用jQuery组件,其指令如下: angular.module('directives.flavr', []) .directive('flavr', function () { return { restrict: 'E', scope: true, link: function (scope, element, attrs) { elemen

我在angular中使用jQuery组件,其指令如下:

angular.module('directives.flavr', [])

    .directive('flavr', function () {
        return {
            restrict: 'E',
            scope: true,
            link: function (scope, element, attrs) {
                element.bind('click', function () {
                    new $.flavr({
                        title: 'Form',
                        content: 'HTML form example',
                        dialog: 'form',
                        form: {content: '<div ng-include="directives/flavr/templates/loginForm.tpl.html"></div>', method: 'post'},
                        onSubmit: function ($container, $form) {
                            alert($form.serialize());
                            return false;
                        }
                    });
                });
            }
        };
    });
<flavr html="/* I want to put a templatecache url and be able to load it when the popup is open */"></flavr>

有什么想法吗?

可能是'ng transclude'在这种情况下会对您有所帮助。您可以在指令中为
templateUrl
使用templateCache或脚本标记模板。如果两者都没有找到,那么它将向服务器上的相同路径发出ajax请求。我认为使用jquery组件来显示角度html不是一个好主意。如果您只想显示静态html文本,那么只需从teplateCache manyally$templateCache.get(attrs.html)加载它