gpt4 book ai didi

javascript - angularjs 无法加载 jaydata 模块

转载 作者:行者123 更新时间:2023-12-03 10:27:36 25 4
gpt4 key购买 nike

a我正在创建一个 AngularJS 应用程序。我必须使用 Jaydata 来使用 odata3 Web 服务。我正在使用名为 Metronics 的主题.

我在控制台中看到的错误是:

http://errors.angularjs.org/1.3.15/$injector/modulerr?p0=MetronicApp&p1=Error%3A%20%5B%24injector%3Amodulerr%5D%20http%3A%2F%2Ferrors.angularjs.org%2F1.3.15%2F%24injector%2Fmodulerr%3Fp0%3Doc.lazyLoad%26p1%3DError%253A%2520%255B%2524injector%253Anomod%255D%2520http%253A%252F%252Ferrors.angularjs.org%252F1.3.15%252F%2524injector%252Fnomod%253Fp0%253D%252524provide%250A%2520%2520%2520%2520at%2520Error%2520(native)%250A%2520%2520%2520%2520at%2520http%253A%252F%252Flocalhost%253A31176%252FScripts%252Fangular.min.js%253A6%253A417%250A%2520%2520%2520%2520at%2520http%253A%252F%252Flocalhost%253A31176%252FScripts%252Fangular.min.js%253A21%253A412%250A%2520%2520%2520%2520at%2520a%2520(http%253A%252F%252Flocalhost%253A31176%252FScripts%252Fangular.min.js%253A21%253A53)%250A%2520%2520%2520%2520at%2520Object.w.bootstrap%2520%255Bas%2520module%255D%2520(http%253A%252F%252Flocalhost%253A31176%252FScripts%252Fangular.min.js%253A21%253A296)%250A%2520%2520%2520%2520at%2520u%2520(http%253A%252F%252Flocalhost%253A31176%252Fassets%252Fglobal%252Fplugins%252Fangularjs%252Fplugins%252FocLazyLoad.min.js%253A8%253A2925)%250A%2520%2520%2520%2520at%2520Object.r%2520%255Bas%2520forEach%255D%2520(http%253A%252F%252Flocalhost%253A31176%252FScripts%252Fangular.min.js%253A7%253A302)%250A%2520%2520%2520%2520at%2520u%2520(http%253A%252F%252Flocalhost%253A31176%252Fassets%252Fglobal%252Fplugins%252Fangularjs%252Fplugins%252FocLazyLoad.min.js%253A8%253A2994)%250A%2520%2520%2520%2520at%2520Object.r%2520%255Bas%2520forEach%255D%2520(http%253A%252F%252Flocalhost%253A31176%252FScripts%252Fangular.min.js%253A7%253A302)%250A%2520%2520%2520%2520at%2520u%2520(http%253A%252F%252Flocalhost%253A31176%252Fassets%252Fglobal%252Fplugins%252Fangularjs%252Fplugins%252FocLazyLoad.min.js%253A8%253A2994)%0A%20%20%20%20at%20Error%20(native)%0A%20%20%20%20at%20http%3A%2F%2Flocalhost%3A31176%2FScripts%2Fangular.min.js%3A6%3A417%0A%20%20%20%20at%20http%3A%2F%2Flocalhost%3A31176%2FScripts%2Fangular.min.js%3A35%3A320%0A%20%20%20%20at%20r%20(http%3A%2F%2Flocalhost%3A31176%2FScripts%2Fangular.min.js%3A7%3A302)%0A%20%20%20%20at%20g%20(http%3A%2F%2Flocalhost%3A31176%2FScripts%2Fangular.min.js%3A34%3A399)%0A%20%20%20%20at%20http%3A%2F%2Flocalhost%3A31176%2FScripts%2Fangular.min.js%3A35%3A63%0A%20%20%20%20at%20r%20(http%3A%2F%2Flocalhost%3A31176%2FScripts%2Fangular.min.js%3A7%3A302)%0A%20%20%20%20at%20g%20(http%3A%2F%2Flocalhost%3A31176%2FScripts%2Fangular.min.js%3A34%3A399)%0A%20%20%20%20at%20ab%20(http%3A%2F%2Flocalhost%3A31176%2FScripts%2Fangular.min.js%3A38%3A135)%0A%20%20%20%20at%20d%20(http%3A%2F%2Flocalhost%3A31176%2FScripts%2Fangular.min.js%3A17%3A381

我已在 app.js 中添加了所需的模块(即“jaydata”)

'use strict';

var app = angular.module("app", [
"ui.router",
"ui.bootstrap",
"oc.lazyLoad",
"ngSanitize",
"jaydata" // <=== when I remove this and remove $data from controller, everything except jaydata specific things work.
]);

/* Setup Rounting For All Pages */
app.config(['$stateProvider', '$urlRouterProvider', function($stateProvider, $urlRouterProvider) {
// Redirect any unmatched url
$urlRouterProvider.otherwise("/Dashboard");

//... states of all pages/routes using $stateProvider

]);


// this controller is in separate file. loaded by lazyLoad along with the view
// when I remove $data from this controller and 'jaydata' from app, everything except jaydata specific things work.
app.controller('TicketsController',[ '$rootScope','$data', '$scope', '$http', '$timeout',function ($rootScope,$data, $scope, $http, $timeout) {
$scope.$on('$viewContentLoaded', function () {
theme.initAjax(); // initialize core components
});
console.log($data);

//jaydata specific code.

// set sidebar closed and body solid layout mode
$rootScope.settings.layout.pageBodySolid = false;
$rootScope.settings.layout.pageSidebarClosed = false;
}]);
<!-- the view loads here-->
<div ui-view class="fade-in-up">
</div>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="http://include.jaydata.org/jaydata.js"></script>
<script src="http://include.jaydata.org/datajs-1.0.3.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<script src="http://include.jaydata.org/jaydatamodules/angular.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.15/angular-sanitize.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.15/angular-touch.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/angular-ui-router/0.2.13/angular-ui-router.min.js"></script>
<script src="http://raw.githubusercontent.com/ocombe/ocLazyLoad/master/dist/ocLazyLoad.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.12.1/ui-bootstrap-tpls.min.js"></script>

请帮忙。您可以在这里找到主题的代码: http://www.keenthemes.com/preview/metronic/theme/templates/admin/angularjs/#/dashboard.html

最佳答案

“oc.lazyLoad”模块与 jaydata 冲突。

当我遇到这个问题时,我删除了该模块,然后 jaydata 就可以工作了。

关于javascript - angularjs 无法加载 jaydata 模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29346761/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com