【问题标题】:Including directives with phonegap包括带有 phonegap 的指令
【发布时间】:2016-03-20 16:06:53
【问题描述】:

确切地说,我正在使用 yeoman 生成一个 Angular 应用程序并使用 phonegap 将其部署到移动平台 (ios),但是我在获取指令工作时遇到了问题。

我有一个名为“header”的指令,它基本上按照盒子上所说的去做,并显示一个标题,看起来像这样。

确切地说,我正在使用 yeoman 生成一个 Angular 应用程序并使用 phonegap 将其部署到移动平台 (ios),但是我在获取指令工作时遇到了问题。

我有一个名为“header”的指令,它基本上按照盒子上所说的去做,并显示一个标题,看起来像这样。

angular.module('myappApp').directive('header', function(contentUpdater) {

    function link(scope) {
        scope.contentUpdater = contentUpdater;
        scope.headerTextThin = scope.contentUpdater.getHeaderTextThin();
        scope.headerTextBold = scope.contentUpdater.getHeaderTextBold();
    }

    return {
        restrict: 'E',
        link: link,
        scope: {
        },
        templateUrl: 'header.html'
    };
});

即使它显示在浏览器上,当我使用 phonegap run ios 进行模拟时,它也不会显示。我确实在 app/scripts/directives/header.html 下有标题,在 app/scripts/directives/header.js 中有 js 文件

【问题讨论】:

    标签: javascript ios angularjs cordova


    【解决方案1】:

    我不记得 Phonegap 默认是否会缩小代码,但也许它在将 Javascript 部署到 iOS 之前将其丑化?

    在这种情况下,这应该可以解决问题:

    angular.module('myappApp').directive('header', 
    ['contentUpdater', function(contentUpdater) {
        // ...
    }]);
    

    【讨论】:

    • @adanalig 缩小是否会搞乱其他注入?
    猜你喜欢
    • 2010-11-05
    • 1970-01-01
    • 2021-02-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多