【问题标题】:Calling angular directive from meteor isn't working从流星调用角度指令不起作用
【发布时间】:2015-11-24 19:40:36
【问题描述】:

我正在尝试从流星调用角度指令来显示直觉按钮。我曾尝试直接在流星中使用快速手册按钮,但它不起作用,因为它不允许我在我选择的区域中显示按钮。因此这条路线。

指令在js文件中定义如下

if (Meteor.isClient) {
console.log("Yes Client"); 
angular.module('connectIntuitAngular',['angular-meteor'])
.directive('connectToQuickbooks', function($window){
 return {
            restrict: 'E',
            template: '<ipp:connectToIntuit></ipp:connectToIntuit>',
            link: function(scope) {
                var script = $window.document.createElement("script");
                script.type = "text/javascript";
                script.src = "https://appcenter.intuit.com/Content/IA/intuit.ipp.anywhere-1.3.3.js";
                script.onload = function () {
                    console.log("On Load Called");
                    scope.$emit('intuitjs:loaded');
                };
                $window.document.body.appendChild(script);
                scope.$on('intuitjs:loaded', function (evt) {
                    $window.intuit.ipp.anywhere.setup({ grantUrl: '/' });
                    scope.connected = true;
                    scope.$apply();
                });
            }
        }
    });

}

我尝试通过以下方式在流星模板中使用此指令,但按钮不显示,模板中的其余组件显示。

<div ng-app="connectIntuitAngular">
<connect-to-quickbooks></connect-to-quickbooks>
</div>

当我以普通角度尝试时,相同的代码可以工作,我还包含了流星角度包(urigo:angular)。

【问题讨论】:

    标签: meteor angular-meteor


    【解决方案1】:

    改变

    angular.module('connectIntuitAngular',['angular-meteor'])

    angular.module('connectIntuitAngular')

    它可能会起作用。每次调用angular.module 时都不需要包含其他模块。

    【讨论】:

    • 谢谢,我已经尝试过了,但它似乎不起作用。当我没有通过第二个参数时,我看到以下错误。 ######################### 未捕获的错误:[$injector:nomod] 模块“connectIntuitAngular”不可用!您要么拼错了模块名称,要么忘记加载它。如果注册模块,请确保将依赖项指定为第二个参数。 errors.angularjs.org/1.4.4/$injector/…
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多