我正在尝试使用Angular.js构建一个Phonegap应用程序
我在directive.js中有指令:
angular.module('myApp') .directive('ngHeaderline',['Auth',function(Auth) { return { templateUrl: '/views/partials/header.html',replace: true,scope: true,link: function($scope) { $scope.isAuthenticated = Auth.isLoggedIn; $scope.logout = Auth.logout(); } } }]);
让我们假设所有元素都存在.验证工厂和模板(当我在Chrome浏览器上测试时一切正常显示)
然后在我的index.html中我有:
<body> <div ng-headerline></div> <div class="main-content"> <div ng-errorline></div> <div ng-loadingline></div> <div ng-view=""></div> </div> <!-- Foundation JS dependencies --> <script src="bower_components/foundation/js/vendor/custom.modernizr.js"></script> <script src="bower_components/foundation/js/foundation/foundation.js"></script> <script src="scripts/vendor/cordova.js"></script> <script src="bower_components/jquery/jquery.js"></script> <script src="bower_components/jquery.formatDateTime/jquery.formatDateTime.js"></script> <script src="bower_components/jquery-ui/ui/jquery-ui.js"></script> <script src="bower_components/angular/angular.js"></script> <script src="bower_components/angular-resource/angular-resource.js"></script> <script src="bower_components/angular-cookies/angular-cookies.js"></script> <script src="bower_components/angular-sanitize/angular-sanitize.js"></script> <script src="bower_components/angular-route/angular-route.js"></script> <script src="bower_components/foundation/js/foundation/foundation.js"></script> <script src="bower_components/foundation/js/foundation/foundation.topbar.js"></script> <script src="scripts/controllers/main.js"></script> <script src="js/app.js"></script> <script src="js/services.js"></script> <script src="js/controllers.js"></script> <script src="js/filters.js"></script> <script src="js/directives.js"></script> </body>
我的header.html部分看起来像这样:
<div class="app"> <div ng-show="isAuthenticated()"> My Header </div> </div>
重复一遍,当我在浏览器上显示时,一切都正确显示,但是当我使用Phonegap编译并部署到Android设备时,标题没有显示.
可能是什么问题呢?