Angular.js重复请求并且从不加载

时间:2015-10-03 04:47:22

标签: javascript angularjs web-applications httprequest

我正在学习Angular.js,所以我有一个简单的Node应用程序,它提供一个非常基本的Angular网页,并将简单的日志数据写入stdout。到目前为止,这已经运行得很好,但是现在,由于没有明显的原因,每次我尝试加载页面时,页面都不会加载(并最终崩溃),直到我被内存问题强行杀死它,这发生在Node app:

My-iMac:Learning Angular.js me$ node node-app.js
Incoming request for /libs/bootstrap/js/bootstrap.min.js?_=1443846525840
Loaded page /libs/bootstrap/js/bootstrap.min.js?_=1443846525840
Incoming request for /libs/angular.min.js?_=1443846526063
Loaded page /libs/angular.min.js?_=1443846526063
Incoming request for /libs/angular-route.min.js?_=1443846526340
Loaded page /libs/angular-route.min.js?_=1443846526340
Incoming request for /js/3.js?_=1443846526389
Loaded page /js/3.js?_=1443846526389
Incoming request for /libs/jquery.min.js?_=1443846526398
Loaded page /libs/jquery.min.js?_=1443846526398
Incoming request for /libs/bootstrap/js/bootstrap.min.js?_=1443846526637
Loaded page /libs/bootstrap/js/bootstrap.min.js?_=1443846526637
Incoming request for /libs/angular.min.js?_=1443846526645
Loaded page /libs/angular.min.js?_=1443846526645
Incoming request for /libs/angular-route.min.js?_=1443846526693
Loaded page /libs/angular-route.min.js?_=1443846526693
Incoming request for /js/3.js?_=1443846526698
Loaded page /js/3.js?_=1443846526698
Incoming request for /libs/jquery.min.js?_=1443846526739
Loaded page /libs/jquery.min.js?_=1443846526739
Incoming request for /libs/bootstrap/js/bootstrap.min.js?_=1443846526751
Loaded page /libs/bootstrap/js/bootstrap.min.js?_=1443846526751
Incoming request for /libs/angular.min.js?_=1443846526758
Loaded page /libs/angular.min.js?_=1443846526758
Incoming request for /libs/angular-route.min.js?_=1443846526789
Loaded page /libs/angular-route.min.js?_=1443846526789
Incoming request for /js/3.js?_=1443846526795
Loaded page /js/3.js?_=1443846526795
Incoming request for /libs/jquery.min.js?_=1443846526802
Loaded page /libs/jquery.min.js?_=1443846526802
Incoming request for /libs/bootstrap/js/bootstrap.min.js?_=1443846527180
Loaded page /libs/bootstrap/js/bootstrap.min.js?_=1443846527180
Incoming request for /libs/angular.min.js?_=1443846527190
Loaded page /libs/angular.min.js?_=1443846527190
Incoming request for /libs/angular-route.min.js?_=1443846527220
Loaded page /libs/angular-route.min.js?_=1443846527220
Incoming request for /js/3.js?_=1443846527225
Loaded page /js/3.js?_=1443846527225
Incoming request for /libs/jquery.min.js?_=1443846527235
Loaded page /libs/jquery.min.js?_=1443846527235
Incoming request for /libs/bootstrap/js/bootstrap.min.js?_=1443846527246
Loaded page /libs/bootstrap/js/bootstrap.min.js?_=1443846527246
Incoming request for /libs/angular.min.js?_=1443846527254
Loaded page /libs/angular.min.js?_=1443846527254
Incoming request for /libs/angular-route.min.js?_=1443846527266
Loaded page /libs/angular-route.min.js?_=1443846527266
Incoming request for /js/3.js?_=1443846527281
Loaded page /js/3.js?_=1443846527281
Incoming request for /libs/jquery.min.js?_=1443846527340
Loaded page /libs/jquery.min.js?_=1443846527340
Incoming request for /libs/bootstrap/js/bootstrap.min.js?_=1443846527363
Loaded page /libs/bootstrap/js/bootstrap.min.js?_=1443846527363
Incoming request for /libs/angular.min.js?_=1443846527935
Loaded page /libs/angular.min.js?_=1443846527935
Incoming request for /libs/angular-route.min.js?_=1443846527957
Loaded page /libs/angular-route.min.js?_=1443846527957
Incoming request for /js/3.js?_=1443846527963
Loaded page /js/3.js?_=1443846527963
Incoming request for /libs/jquery.min.js?_=1443846527973
Loaded page /libs/jquery.min.js?_=1443846527973
Incoming request for /libs/bootstrap/js/bootstrap.min.js?_=1443846528005
Loaded page /libs/bootstrap/js/bootstrap.min.js?_=1443846528005
Incoming request for /libs/angular.min.js?_=1443846528019
Loaded page /libs/angular.min.js?_=1443846528019
Incoming request for /libs/angular-route.min.js?_=1443846528031
Loaded page /libs/angular-route.min.js?_=1443846528031
Incoming request for /js/3.js?_=1443846528035
Loaded page /js/3.js?_=1443846528035
Incoming request for /libs/jquery.min.js?_=1443846528043
Loaded page /libs/jquery.min.js?_=1443846528043
Incoming request for /libs/bootstrap/js/bootstrap.min.js?_=1443846528056
Loaded page /libs/bootstrap/js/bootstrap.min.js?_=1443846528056
Incoming request for /libs/angular.min.js?_=1443846528065
Loaded page /libs/angular.min.js?_=1443846528065
Incoming request for /libs/angular-route.min.js?_=1443846528141
Loaded page /libs/angular-route.min.js?_=1443846528141
Incoming request for /js/3.js?_=1443846528496
Loaded page /js/3.js?_=1443846528496
Incoming request for /libs/jquery.min.js?_=1443846528520
Loaded page /libs/jquery.min.js?_=1443846528520
Incoming request for /libs/bootstrap/js/bootstrap.min.js?_=1443846528546
Loaded page /libs/bootstrap/js/bootstrap.min.js?_=1443846528546
Incoming request for /libs/angular.min.js?_=1443846528553
Loaded page /libs/angular.min.js?_=1443846528553
Incoming request for /libs/angular-route.min.js?_=1443846528564
Loaded page /libs/angular-route.min.js?_=1443846528564
Incoming request for /js/3.js?_=1443846528605
Loaded page /js/3.js?_=1443846528605
Incoming request for /libs/jquery.min.js?_=1443846528643
Loaded page /libs/jquery.min.js?_=1443846528643
Incoming request for /libs/bootstrap/js/bootstrap.min.js?_=1443846528656
Loaded page /libs/bootstrap/js/bootstrap.min.js?_=1443846528656
Incoming request for /libs/angular.min.js?_=1443846528679
Loaded page /libs/angular.min.js?_=1443846528679
Incoming request for /libs/angular-route.min.js?_=1443846528694
Loaded page /libs/angular-route.min.js?_=1443846528694
Incoming request for /js/3.js?_=1443846528700
Loaded page /js/3.js?_=1443846528700
Incoming request for /libs/jquery.min.js?_=1443846528708
Loaded page /libs/jquery.min.js?_=1443846528708
Incoming request for /libs/bootstrap/js/bootstrap.min.js?_=1443846528726
Loaded page /libs/bootstrap/js/bootstrap.min.js?_=1443846528726
Incoming request for /libs/angular.min.js?_=1443846529054
Loaded page /libs/angular.min.js?_=1443846529054
Incoming request for /libs/angular-route.min.js?_=1443846529083
Loaded page /libs/angular-route.min.js?_=1443846529083
Incoming request for /js/3.js?_=1443846529088
Loaded page /js/3.js?_=1443846529088
Incoming request for /libs/jquery.min.js?_=1443846529096
Loaded page /libs/jquery.min.js?_=1443846529096
Incoming request for /libs/bootstrap/js/bootstrap.min.js?_=1443846529128
Loaded page /libs/bootstrap/js/bootstrap.min.js?_=1443846529128
Incoming request for /libs/angular.min.js?_=1443846529331
Loaded page /libs/angular.min.js?_=1443846529331
Incoming request for /libs/angular-route.min.js?_=1443846529354
Loaded page /libs/angular-route.min.js?_=1443846529354
Incoming request for /js/3.js?_=1443846529657
Loaded page /js/3.js?_=1443846529657
Incoming request for /libs/jquery.min.js?_=1443846529679
Loaded page /libs/jquery.min.js?_=1443846529679
Incoming request for /libs/bootstrap/js/bootstrap.min.js?_=1443846529694
Loaded page /libs/bootstrap/js/bootstrap.min.js?_=1443846529694
Incoming request for /libs/angular.min.js?_=1443846529728
Loaded page /libs/angular.min.js?_=1443846529728
Incoming request for /libs/angular-route.min.js?_=1443846529740
Loaded page /libs/angular-route.min.js?_=1443846529740
Incoming request for /js/3.js?_=1443846529744
Loaded page /js/3.js?_=1443846529744
Incoming request for /libs/jquery.min.js?_=1443846529751
Loaded page /libs/jquery.min.js?_=1443846529751
Incoming request for /libs/bootstrap/js/bootstrap.min.js?_=1443846529764
Loaded page /libs/bootstrap/js/bootstrap.min.js?_=1443846529764
Incoming request for /libs/angular.min.js?_=1443846529795
Loaded page /libs/angular.min.js?_=1443846529795
Incoming request for /libs/angular-route.min.js?_=1443846529902
Loaded page /libs/angular-route.min.js?_=1443846529902
Incoming request for /js/3.js?_=1443846529943
Loaded page /js/3.js?_=1443846529943
Incoming request for /libs/jquery.min.js?_=1443846529950
Loaded page /libs/jquery.min.js?_=1443846529950
Incoming request for /libs/bootstrap/js/bootstrap.min.js?_=1443846529967
Loaded page /libs/bootstrap/js/bootstrap.min.js?_=1443846529967
Incoming request for /libs/angular.min.js?_=1443846530108
Loaded page /libs/angular.min.js?_=1443846530108
Incoming request for /libs/angular-route.min.js?_=1443846530137
Loaded page /libs/angular-route.min.js?_=1443846530137
Incoming request for /js/3.js?_=1443846530144
Loaded page /js/3.js?_=1443846530144
Incoming request for /libs/jquery.min.js?_=1443846530153
Loaded page /libs/jquery.min.js?_=1443846530153
Incoming request for /libs/bootstrap/js/bootstrap.min.js?_=1443846530165
Loaded page /libs/bootstrap/js/bootstrap.min.js?_=1443846530165
Incoming request for /libs/angular.min.js?_=1443846530173
Loaded page /libs/angular.min.js?_=1443846530173
Incoming request for /libs/angular-route.min.js?_=1443846530189
Loaded page /libs/angular-route.min.js?_=1443846530189
Incoming request for /js/3.js?_=1443846530196
Loaded page /js/3.js?_=1443846530196
Incoming request for /libs/jquery.min.js?_=1443846530204
Loaded page /libs/jquery.min.js?_=1443846530204
Incoming request for /libs/bootstrap/js/bootstrap.min.js?_=1443846530611
Loaded page /libs/bootstrap/js/bootstrap.min.js?_=1443846530611
Incoming request for /libs/angular.min.js?_=1443846530844
Loaded page /libs/angular.min.js?_=1443846530844
Incoming request for /libs/angular-route.min.js?_=1443846530857
Loaded page /libs/angular-route.min.js?_=1443846530857
Incoming request for /js/3.js?_=1443846530862
Loaded page /js/3.js?_=1443846530862
Incoming request for /libs/jquery.min.js?_=1443846530898
Loaded page /libs/jquery.min.js?_=1443846530898
Incoming request for /libs/bootstrap/js/bootstrap.min.js?_=1443846530909
Loaded page /libs/bootstrap/js/bootstrap.min.js?_=1443846530909
Incoming request for /libs/angular.min.js?_=1443846531006
Loaded page /libs/angular.min.js?_=1443846531006
Incoming request for /libs/angular-route.min.js?_=1443846531021
Loaded page /libs/angular-route.min.js?_=1443846531021
Incoming request for /js/3.js?_=1443846531140
Loaded page /js/3.js?_=1443846531140
Incoming request for /libs/jquery.min.js?_=1443846531146
Loaded page /libs/jquery.min.js?_=1443846531146
Incoming request for /libs/bootstrap/js/bootstrap.min.js?_=1443846531501
Loaded page /libs/bootstrap/js/bootstrap.min.js?_=1443846531501
Incoming request for /libs/angular.min.js?_=1443846531520
Loaded page /libs/angular.min.js?_=1443846531520
Incoming request for /libs/angular-route.min.js?_=1443846531680
Loaded page /libs/angular-route.min.js?_=1443846531680
Incoming request for /js/3.js?_=1443846532119
Loaded page /js/3.js?_=1443846532119
Incoming request for /libs/jquery.min.js?_=1443846532128
Loaded page /libs/jquery.min.js?_=1443846532128
Incoming request for /libs/bootstrap/js/bootstrap.min.js?_=1443846532161
Loaded page /libs/bootstrap/js/bootstrap.min.js?_=1443846532161
Incoming request for /libs/angular.min.js?_=1443846532359
Loaded page /libs/angular.min.js?_=1443846532359
Incoming request for /libs/angular-route.min.js?_=1443846532386
Loaded page /libs/angular-route.min.js?_=1443846532386
Incoming request for /js/3.js?_=1443846532396
Loaded page /js/3.js?_=1443846532396
Incoming request for /libs/jquery.min.js?_=1443846532414
Loaded page /libs/jquery.min.js?_=1443846532414
Incoming request for /libs/bootstrap/js/bootstrap.min.js?_=1443846532619
Loaded page /libs/bootstrap/js/bootstrap.min.js?_=1443846532619
Incoming request for /libs/angular.min.js?_=1443846532634
Loaded page /libs/angular.min.js?_=1443846532634
Incoming request for /libs/angular-route.min.js?_=1443846533444
Loaded page /libs/angular-route.min.js?_=1443846533444
Incoming request for /js/3.js?_=1443846533472
Loaded page /js/3.js?_=1443846533472
Incoming request for /libs/jquery.min.js?_=1443846533480
Loaded page /libs/jquery.min.js?_=1443846533480
Incoming request for /libs/bootstrap/js/bootstrap.min.js?_=1443846534037
Loaded page /libs/bootstrap/js/bootstrap.min.js?_=1443846534037
Incoming request for /libs/angular.min.js?_=1443846534046
Loaded page /libs/angular.min.js?_=1443846534046
Incoming request for /libs/angular-route.min.js?_=1443846534058
Loaded page /libs/angular-route.min.js?_=1443846534058
Incoming request for /js/3.js?_=1443846534191
Loaded page /js/3.js?_=1443846534191
Incoming request for /libs/jquery.min.js?_=1443846534253
Loaded page /libs/jquery.min.js?_=1443846534253
Incoming request for /libs/bootstrap/js/bootstrap.min.js?_=1443846534282
Loaded page /libs/bootstrap/js/bootstrap.min.js?_=1443846534282
Incoming request for /libs/angular.min.js?_=1443846534298
Loaded page /libs/angular.min.js?_=1443846534298
Incoming request for /libs/angular-route.min.js?_=1443846534343
Loaded page /libs/angular-route.min.js?_=1443846534343
Incoming request for /js/3.js?_=1443846534349
Loaded page /js/3.js?_=1443846534349
Incoming request for /libs/jquery.min.js?_=1443846534362
Loaded page /libs/jquery.min.js?_=1443846534362
Incoming request for /libs/bootstrap/js/bootstrap.min.js?_=1443846534377
Loaded page /libs/bootstrap/js/bootstrap.min.js?_=1443846534377
Incoming request for /libs/angular.min.js?_=1443846534385
Loaded page /libs/angular.min.js?_=1443846534385
Incoming request for /libs/angular-route.min.js?_=1443846534401
Loaded page /libs/angular-route.min.js?_=1443846534401
Incoming request for /js/3.js?_=1443846534409
Loaded page /js/3.js?_=1443846534409
Incoming request for /libs/jquery.min.js?_=1443846534416
Loaded page /libs/jquery.min.js?_=1443846534416
Incoming request for /libs/bootstrap/js/bootstrap.min.js?_=1443846534427
Loaded page /libs/bootstrap/js/bootstrap.min.js?_=1443846534427

以下是Angular的代码:

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

app.config(['$routeProvider', function($routeProvider) {
    $routeProvider
    .when('/', {
        controller: 'MainController',
        templateUrl: './main6.html'
    })
    .when('/company', {
        controller: 'CompanyController',
        templateUrl: './company6.html'
    })
    .otherwise({
        redirectTo: '/'
    });
}]);

app.controller('MainController', function($scope) {
    $scope.companies = [{
        heading: 'text1',
        content: 'Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. '
    }, {
        heading: 'Text2',
        content: 'Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. '
    }, {
        heading: 'SoMe3',
        content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus dapibus egestas mauris. Etiam blandit turpis a sapien pretium condimentum. Duis dapibus arcu ac tellus euismod, non feugiat est vulputate. Cras nec sodales felis. Sed ac massa lacus. Nunc in tellus a ante fermentum consectetur a at nulla. Cras nec egestas. '
    }, {
        heading: 'Pickles',
        content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi erat augue, tristique a sollicitudin nec, rhoncus et nisi. Aenean at mi ex. Sed tincidunt euismod porttitor. Quisque varius elit in efficitur placerat. Morbi quis turpis facilisis, congue purus ut, vehicula felis. Nam ex nulla, pellentesque vitae ipsum eget, tincidunt luctus.'
    }, {
        heading: 'Dill',
        content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi erat augue, tristique a sollicitudin nec, rhoncus et nisi. Aenean at mi ex. Sed tincidunt euismod porttitor. Quisque varius elit in efficitur placerat. Morbi quis turpis facilisis, congue purus ut, vehicula felis. Nam ex nulla, pellentesque vitae ipsum eget, tincidunt luctus.'
    }];
});

app.controller('CompanyController', function($scope) {
    $scope.companies = [{
        heading: 'text1',
        content: 'Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. '
    }, {
        heading: 'Text2',
        content: 'Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. '
    }, {
        heading: 'SoMe3',
        content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus dapibus egestas mauris. Etiam blandit turpis a sapien pretium condimentum. Duis dapibus arcu ac tellus euismod, non feugiat est vulputate. Cras nec sodales felis. Sed ac massa lacus. Nunc in tellus a ante fermentum consectetur a at nulla. Cras nec egestas. '
    }, {
        heading: 'Pickles',
        content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi erat augue, tristique a sollicitudin nec, rhoncus et nisi. Aenean at mi ex. Sed tincidunt euismod porttitor. Quisque varius elit in efficitur placerat. Morbi quis turpis facilisis, congue purus ut, vehicula felis. Nam ex nulla, pellentesque vitae ipsum eget, tincidunt luctus.'
    }, {
        heading: 'Dill',
        content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi erat augue, tristique a sollicitudin nec, rhoncus et nisi. Aenean at mi ex. Sed tincidunt euismod porttitor. Quisque varius elit in efficitur placerat. Morbi quis turpis facilisis, congue purus ut, vehicula felis. Nam ex nulla, pellentesque vitae ipsum eget, tincidunt luctus.'
    }];
});

为什么Angular应用程序会对文件进行连续请求和重新请求,而不是正常加载和行为?如果它有帮助,那么当我在修改路由时就会出现这个问题。

更新1:

当我改变这个时:

.when('/company', {
    controller: 'CompanyController',
    templateUrl: './company6.html'
})

到此:

.when('/company', {
    controller: 'CompanyController',
    templateUrl: './main6.html'
})

没有更多请求进入服务器," / company"加载与" /"相同的页面。显然这会使页面相当无用,如果每个url只能加载相同的模板,但信息可能会有所帮助。值得注意的是" main6.html"和" company6.html"基本相同,除了一些改变的文字。

更新2:

我已经发现每当我使用./main6.html作为模板网址时,它就能正常工作,但是当我使用./company6.html时,它并没有。这意味着此问题与加载/company页面隔离,/页面加载就好了。我已检查过company6.html中的拼写错误,文件名拼写错误,html错误,但html几乎与main6.html相同,只有少数文字差异。

更新3:

以下是main6.html的代码(company6.html有不同的lorem ipsum,但在其他方面是相同的):

<nav class="navbar navbar-inverse navbar-fixed-top">
    <div class="container">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="/">NYSE Companies</a>
        </div>
        <div id="navbar" class="navbar-collapse collapse">
            <form class="navbar-form navbar-right">
                <div class="form-group">
                    <input type="text" placeholder="Email" class="form-control">
                </div>
                <div class="form-group">
                    <input type="password" placeholder="Password" class="form-control">
                </div>
                <button type="submit" class="btn btn-success">Sign in</button>
            </form>
        </div>
    </div>
</nav>

<div class="jumbotron">
    <div class="container">
        <h1>Lorem Ipsum Dolor Sit Amet</h1>
        <p>Quisque ultrices libero quis fringilla tempor. Ut egestas sapien posuere lorem eleifend bibendum. Duis et pellentesque ex, id scelerisque urna. Nullam ullamcorper molestie urna, eget lobortis eros finibus eu. Donec a vulputate nisi. Quisque eget ullamcorper nulla.</p>
    </div>
</div>

<div class="container">
    <div class="input-group">
        <span class="input-group-addon" id="basic-addon1"><span class="glyphicon glyphicon-search" aria-hidden="true"></span></span>
        <input type="text" class="form-control" placeholder="Company" aria-describedby="basic-addon1" data-ng-model="search">
    </div>
    <div class="row">
        <div class="col-md-4" data-ng-repeat="company in companies | filter: search">
            <h2>{{company.heading | uppercase}}</h2>
            <p>{{company.content}}</p>
            <p><a class="btn btn-default" href="#/company" role="button">View details »</a></p>
        </div>
    </div>

    <hr>

    <footer>
        <p>Wibbly Wobbly Timey Wimey</p>
    </footer>
</div>

以下是6.html的代码,它是加载角度的实际主页,包含模板:

<!DOCTYPE html>
<html lang="en" data-ng-app="app">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta charset="utf-8">
    <title>Lipsum Dipsum</title>
    <link href="./libs/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <style>
        body {
            padding-top: 50px;
            padding-bottom: 20px;
        }
    </style>
    <script>

    </script>
</head>

<body>
    <div data-ng-view></div>

    <script type="text/javascript" src="./libs/jquery.min.js"></script>
    <script type="text/javascript" src="./libs/bootstrap/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="./libs/angular.min.js"></script>
    <script type="text/javascript" src="./libs/angular-route.min.js"></script>
    <script type="text/javascript" src="./js/3.js"></script>

</body>
</html>

2 个答案:

答案 0 :(得分:0)

我认为你在路由配置中创建了一个无限循环

尝试这样

@Test public void should_do_x() { if (Robolectric.version >= supported_version) { //do something //validate something } }

在我看来,否则条件会将您引导至example.com/,但是如果您只是将一个/添加到一个网站的末尾,它会在其加载后将其删除,然后将您发送回您的其他状态。 / p>

我现在没有权限测试这个,但我很确定这是问题所在。

答案 1 :(得分:0)

我以前在单页应用程序中遇到过这个问题。检查以确保所有templateUrls指向现有文件路径。

我的节点单页面应用程序服务器默认提供index.html文件,只要它通常提供404页面。因此,当指令具有不存在的templateUrl时,服务器将在其位置上提供index.html。随后将加载index.html中的脚本标记,整个过程将重复。

调试此问题的最佳建议是在浏览器中独立访问每个templateUrl。