Search code examples
angularjsdependenciesngroute

Multiple dependencies won't work


Hello I'm trying to create a SPA with AngularJS and need to call a SOAP request. But as soon as i add another dependency beside ngRoute, my views won't load anymore.

Index.html

    <!DOCTYPE html>
    <html class="no-js">
        <head>
            <script src="./angular/soapclient.js"></script>
            <script src="./angular/angular.soap.js"></script>
            <script src="./angular/angular.min.js"></script>
            <script src="./angular/angular-route.min.js"></script>
            <script src="./angular/app.js"></script>
        </head>
        <body data-t-name="ContentPage" ng-app="myApp">
            <div class="page">
                <div class="page-content">
                    <div class="container" id="Dialog1" >
                        <div ng-view ng-controller="MainCtrl"></div>
                    </div>
                </div>
            </div>
        </body>
    </html>

app.js

    var myApp = angular.module("myApp", ['ngRoute']);

    myApp.config(["$routeProvider","$locationProvider",function($routeProvider,$locationProvider) {
        $routeProvider
        .when("/", {
            templateUrl : "views/Hauptseite.html"
        })
        ...
        ...
    }]);

Changed into

var myApp = angular.module("myApp", ['ngRoute','angularSoap']);

Any suggestions ?


Solution

  • Change the order of dependencies, any dependent library should be after angular.js reference

    <script src="./angular/angular.min.js"></script>
    <script src="./angular/soapclient.js"></script>
    <script src="./angular/angular.soap.js"></script>           
    <script src="./angular/angular-route.min.js"></script>
    <script src="./angular/app.js"></script>