2016-08-09 237 views
0

My Angular JS App angezeigt wird diese Meldung in der Konsole zu laden:AngularJS haben versucht, mehr als einmal

angular.min.js versucht, mehr als einmal zu laden.

Die App ist voll funktionsfähig, lädt jedoch alle Ajax-Anfragen mehrmals, bevor sie eine Antwort erhält.

Ich verstehe wirklich nicht, was sein könnte. Ich weiß nicht einmal, welchen Code ich dir zeigen soll.

Wenn jemand will, um mir helfen, mir nur sagen, was Teil meines Codes würden Sie gerne sehen, und ich werde es kopiert hier einfügen ...

danke

UPDATE:

index.blade.php:

@extends('master') 

@section('controller') ng-controller="AppController" @endsection 

@section('content') 

<div class="app" id="app" 
    ng-class="{'app-header-fixed':app.settings.headerFixed, 'app-aside-fixed':app.settings.asideFixed, 'app-aside-folded':app.settings.asideFolded}" 
    ui-view></div> 
<!-- jQuery --> 
<script src="js/jquery/jquery.min.js"></script> 
<script src="js/libs/moment.min.js"></script> 

<script> 
    window.__user = {{Auth::user()->toJson()}}; 
    window.__user_details = {{Auth::user()->details->toJson()}}; 
    window.__company = {{ Auth::user()->getCompany()->toJson()}} 

    <?php if(Department::where('company_id', Auth::user()->company_id)->first()): ?> 
      window.__startDepartment = {{ Department::where('company_id','=',Auth::user()->company_id)->first()->id }} 
    <?php endif; ?> 
    @if(Auth::user()->user_level == 4) 
     window.__companies = {{ Company::all()->toJson() }} 
    @endif; 
</script> 

<script src="https://maps.googleapis.com/maps/api/js?v=3.exp"></script> 
<!-- Angular --> 
<script src="js/angular/angular.min.js"></script> 
<script src="js/angular/angular-cookies.min.js"></script> 
<script src="js/angular/angular-animate.min.js"></script> 
<script src="js/angular/angular-ui-router.min.js"></script> 
<script src="js/angular/angular-translate.js"></script> 
<script src="js/angular/ngStorage.min.js"></script> 
<script src="js/angular/ui-load.js"></script> 
<script src="js/angular/ui-jq.js"></script> 
<script src="js/angular/ui-validate.js"></script> 
<script src="js/angular/ui-bootstrap-tpls.min.js"></script> 
<script src="js/libs/timer.js"></script> 
<script src="js/angular/angular.min.js"></script> 
<script src="js/angular/angular-cookies.min.js"></script> 
<script src="js/angular/angular-animate.min.js"></script> 
<script src="js/angular/angular-ui-router.min.js"></script> 
<script src="js/angular/angular-translate.js"></script> 
<script src="js/angular/ngStorage.min.js"></script> 
<script src="js/angular/ui-load.js"></script> 
<script src="js/angular/ui-jq.js"></script> 
<script src="js/angular/ui-tree.js"></script> 
<script src="js/angular/ui-validate.js"></script> 
<script src="js/angular/ui-bootstrap-tpls.min.js"></script> 
<script src="js/libs/timer.js"></script> 
<!-- App --> 
<script src="js/app.js"></script> 
<script src="js/services.js"></script> 
<script src="js/functions.js"></script> 
<script src="js/controllers/AppController.js"></script> 
<script src="js/controllers/DashboardController.js"></script> 
<script src="js/controllers/DemoControllers.js"></script> 
<script src="js/controllers/LeaveControllers.js"></script> 
<script src="js/controllers/ReporterControllers.js"></script> 
<script src="js/controllers/TimeslotControllers.js"></script> 
<script src="js/controllers/TasksControllers.js"></script> 
<script src="js/controllers/MessagesControllers.js"></script> 
<script src="js/controllers/ResourceControllers.js"></script> 
<script src="js/controllers/LocationControllers.js"></script> 
<script src="js/controllers/StaffController.js"></script> 
<script src="js/controllers/DepartmentControllers.js"></script> 
<script src="js/controllers/OtherControllers.js"></script> 
<script src="js/controllers/DatePickerInputController.js"></script> 
<script src="js/filters.js"></script> 
<script src="js/directives.js"></script> 
<!-- Lazy loading --> 
<script> 
    window.intercomSettings = { 
     app_id: "eoo7q8o9", 
     user_id: '{{{ Auth::user()->id }}}', 
     name: '{{{ Auth::user()->first_name }}} {{{ Auth::user()->surname }}}', 
     email: '{{{ Auth::user()->email }}}', 
     user_type: '{{{ Auth::user()->getUserType() }}}', 
     company: '{{{ Auth::user()->getCompany()->name }}}' 
    }; 
</script> 
<script> 
    (function() { 
     var w = window; 
     var ic = w.Intercom; 
     if (typeof ic === "function") { 
      ic('reattach_activator'); 
      ic('update', intercomSettings); 
     } else { 
      var d = document; 
      var i = function() { 
       i.c(arguments) 
      }; 
      i.q = []; 
      i.c = function (args) { 
       i.q.push(args) 
      }; 
      w.Intercom = i; 
      function l() { 
       var s = d.createElement('script'); 
       s.type = 'text/javascript'; 
       s.async = true; 
       s.src = 'https://widget.intercom.io/widget/eoo7q8o9'; 
       var x = d.getElementsByTagName('script')[0]; 
       x.parentNode.insertBefore(s, x); 
      } 

      if (w.attachEvent) w.attachEvent('onload', l); 
      else w.addEventListener('load', l, false); 
     } 
    })() 
</script> 

@endsection 
+0

Es ist in der Tat besser mit einigen Code Sie zeigt die Seite starten zu helfen – DMCISSOKHO

+0

wo Sie angular.min.js :) –

+0

Mögliche doppelte http Referenz: //stackoverflow.com/questions/23765941/warning-tried-to-load-angular-more-than-once-when-i-include-jquery –

Antwort

1

Sieht aus wie sind Sie Drittanbieter-Bibliotheken geladen zweimal

<script src="js/angular/angular.min.js"></script> 
<script src="js/angular/angular-cookies.min.js"></script> 
<script src="js/angular/angular-animate.min.js"></script> 
<script src="js/angular/angular-ui-router.min.js"></script> 
<script src="js/angular/angular-translate.js"></script> 
<script src="js/angular/ngStorage.min.js"></script> 
<script src="js/angular/ui-load.js"></script> 
<script src="js/angular/ui-jq.js"></script> 
<script src="js/angular/ui-validate.js"></script> 
<script src="js/angular/ui-bootstrap-tpls.min.js"></script> 
<script src="js/libs/timer.js"></script> 
<script src="js/angular/angular.min.js"></script> 
<script src="js/angular/angular-cookies.min.js"></script> 
<script src="js/angular/angular-animate.min.js"></script> 
<script src="js/angular/angular-ui-router.min.js"></script> 
<script src="js/angular/angular-translate.js"></script> 
<script src="js/angular/ngStorage.min.js"></script> 
<script src="js/angular/ui-load.js"></script> 
<script src="js/angular/ui-jq.js"></script> 
<script src="js/angular/ui-tree.js"></script> 
<script src="js/angular/ui-validate.js"></script> 
<script src="js/angular/ui-bootstrap-tpls.min.js"></script> 
<script src="js/libs/timer.js"></script> 
+0

OMG, das habe ich nicht gesehen !!! Ich danke dir sehr ! Ich habe wahrscheinlich eine CTRL + D nicht vor langer Zeit gemacht ^^. – Fab

-1

Es gibt mehrere Gründe dafür. Können Sie Ihren Routing-Code anzeigen? Diese Fehler werden häufig durch eine Mischung von Routen oder eine unsachgemäße Handhabung des Routings verursacht.

+0

Was war der Grund dafür? Ich denke, das ist die legitime Antwort. – Jayesh