本文介绍了未捕获的ReferenceError:未定义模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
顾名思义。在bower启动时使用保留关键字Module时遇到问题。它似乎与下面的代码有关。我似乎无法找到确切的位置,因为它从fetch-bower.js:1开始。谁能帮助我了解如何解决这个问题?
As the name implies. I am experiencing an issue using the reserved keyword "Module" on bower launch. It seems to relate specifically to the code below. I cannot seem to find the exact location, as it starts at "fetch-bower.js:1". Can anyone please help me to understand how to work around this problem?
(function () {
'use strict';
angular.module('BlurAdmin.theme.components')
.directive("digitalClock", function ($timeout, dateFilter) {
return {
restrict: 'E',
link: function (scope, iElement) {
(function updateClock() {
iElement.text(dateFilter(new Date(), 'H:mm:ss'));
$timeout(updateClock, 1000);
})();
}
};
});
});
// HTML
<div class="page-top clearfix" scroll-position="scrolled" max-height="50" ng-class="{'scrolled': scrolled}">
<div class="row col-xs-12">
<div class=""></div>
<div class="aguState col-xs-3 setText">Agu State: </div>
<div class="aguMode col-xs-3 setText">Agu Mode: </div>
<div class="lastUpdate col-xs-3 setText">Last Update: </div>
<digital-clock></digital-clock>
</div>
// Directive.js
//Directive.js
(function () {
'use strict';
angular.module('BlurAdmin.theme.components')
.directive('pageTop', pageTop);
/** @ngInject */
function pageTop() {
return {
restrict: 'E',
templateUrl: 'app/theme/components/pageTop/pageTop.html'
};
}
})();
完整错误
fetch-bower.js:1 Uncaught ReferenceError: module is not defined
at fetch-bower.js:1
(anonymous) @ fetch-bower.js:1
推荐答案
确保在索引中引用angular.js和Directive.js应用程序的.html
Make sure you refer the angular.js and Directive.js in the index.html of the application
<script src="angular.js"></script>
<script src="directive.js"></script>
您还应该为您的应用程序注入空的依赖项,
also you should have empty dependencies injected to your application,
angular.module('BlurAdmin.theme.components',[])
.directive('pageTop', pageTop)
这篇关于未捕获的ReferenceError:未定义模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!