2016-09-20 45 views
0

問題嘗試加載不止一次角更角JS

  • 我是使用jquery具有角JS。

錯誤

angular.js?v=1.6.10_1474366451:12116 TypeError: ha is not a function 
at eval (eval at <anonymous> (http://localhost/weblogs-s2/web/common/assets/libs/jquery/jquery.min.js?v=1.6.10:2:2616), <anonymous>:17:349) 
at eval (eval at <anonymous> (http://localhost/weblogs-s2/web/common/assets/libs/jquery/jquery.min.js?v=1.6.10:2:2616), <anonymous>:308:401) 
at http://localhost/weblogs-s2/web/common/assets/libs/jquery/jquery.min.js?v=1.6.10:2:2616 
at Function.globalEval (http://localhost/weblogs-s2/web/common/assets/libs/jquery/jquery.min.js?v=1.6.10:2:2627) 
at text script (http://localhost/weblogs-s2/web/common/assets/libs/jquery/jquery.min.js?v=1.6.10:4:26788) 
at Qc (http://localhost/weblogs-s2/web/common/assets/libs/jquery/jquery.min.js?v=1.6.10:4:18505) 
at x (http://localhost/weblogs-s2/web/common/assets/libs/jquery/jquery.min.js?v=1.6.10:4:21926) 
at b (http://localhost/weblogs-s2/web/common/assets/libs/jquery/jquery.min.js?v=1.6.10:4:26298) 
at Object.send (http://localhost/weblogs-s2/web/common/assets/libs/jquery/jquery.min.js?v=1.6.10:4:26402) 
at Function.ajax (http://localhost/weblogs-s2/web/common/assets/libs/jquery/jquery.min.js?v=1.6.10:4:21703) <div id="wrapper" ui-view="" class="container ng-scope">(anonymous function) @ angular.js?v=1.6.10_1474366451:12116(anonymous function) @ angular.js?v=1.6.10_1474366451:8976invokeLinkFn @ angular.js?v=1.6.10_1474366451:8527nodeLinkFn @ angular.js?v=1.6.10_1474366451:8034compositeLinkFn @ angular.js?v=1.6.10_1474366451:7435publicLinkFn @ angular.js?v=1.6.10_1474366451:7309updateView @ angular-ui-router.js?v=1.6.10_1474366451:2733(anonymous function) @ angular-ui-router.js?v=1.6.10_1474366451:2697$broadcast @ angular.js?v=1.6.10_1474366451:15893$state.transition.resolved.then.$state.transition @ angular-ui-router.js?v=1.6.10_1474366451:2114processQueue @ angular.js?v=1.6.10_1474366451:14347(anonymous function) @ angular.js?v=1.6.10_1474366451:14363$eval @ angular.js?v=1.6.10_1474366451:15574$digest @ angular.js?v=1.6.10_1474366451:15385$apply @ angular.js?v=1.6.10_1474366451:15679done @ angular.js?v=1.6.10_1474366451:10166completeRequest @ angular.js?v=1.6.10_1474366451:10338requestLoaded @ angular.js?v=1.6.10_1474366451:10279 

解析失敗SourceMap:http://localhost/weblogs-s2/web/metisMenu.js.map

 <div id="wrapper" ui-view="" class="container ng-scope"> 

角js代碼

var sbAdmin2 = angular.module('sbAdmin2', ['ui.router','ngSanitize']); 


sbAdmin2.config(function($stateProvider, $urlRouterProvider) { 

$urlRouterProvider.otherwise(''); 

$stateProvider 

    // HOME STATES AND NESTED VIEWS ======================================== 
    .state('Dashboard', { 
     url: '/dashboard/data', 
     templateUrl: 'http://localhost/weblogs-s2/web/weblogs_dev.php/dashboard/data' 
    }) 

    }) 

腳本我已經使用

<html> 
    <head> 
    <script src="{{ asset ('common/assets/libs/jquery/jquery.min.js') }}?v={{ app_version }}"></script> 
    <script src="{{ asset ('common/assets/libs/jquery/jquery-ui/js/jquery-ui.min.js') }}?v={{ app_version }}"></script> 
    <script src="{{asset('common/assets/libs/angular/source/angular.js') }}?v={{ app_version }}_{{ NOW }}"></script> 
    <script src="{{ asset ('common/assets/libs/angular/source/modules/angular-ui-router.js') }}?v={{ app_version }}_{{ NOW }}"></script> 
    <script src="{{ asset ('common/assets/libs/angular/source/modules/angular-sanitize.js') }}?v={{ app_version }}_{{ NOW }}"></script> 
</head> 
    <body> 
    <div id="wrapper" ui-view class="container ng-scope" > 
    </div> 
</body> 
</html> 

我已經一派

  • jquery的具有角JS庫衝突。
  • 當我在jquery應用程序正常工作之前加載角js。
  • 但我需要在數據表中填充數據然後datatable是不工作。
  • 這意味着對於數據表需要jQuery的第一次加載。

我需要

  • 是有可能的角度JS庫之前加載的jQuery或它可能衝突。

    problem arise when i was using datatable using jquery then it would not work when i used jquery after angular js. 
    

任何建議,最歡迎

回答

0

角V1.3只支持jQuery的2.1及以上

Angular 1.3 only supports jQuery 2.1 or above. jQuery 1.7 and newer might work correctly with Angular but we don't guarantee that.

來源:https://docs.angularjs.org/misc/faq

它看起來像你使用jQuery v1.6.10(如果存在的話)。嘗試更新到更新版本的jQuery。

(還要確保您使用的角度V1。*,而不是角V2。*)

+0

喜丹尼爾,我認爲我們不能使用jQuery的有角的js – afeef

+0

我們使用Symfony2中的數據表中的lib,但我們面臨的角.js?v = 1.6.10_1474973236:12116 TypeError:$(...)。dataTable不是函數 – afeef

+0

您肯定可以使用jQuery和Angular!你是否包含dataTable腳本?確保在jQuery之後包含它。也請確保在jQuery後包含Angular –