自更新的角度2版本以来,请求被取消

时间:2017-03-26 10:48:05

标签: javascript angularjs angular webpack

所以,自从{ "name": "xxx", "version": "1.0.0", "description": "xxx messanger web app", "scripts": { "clean": "rimraf node_modules doc dist && npm cache clean", "clean-install": "npm run clean && npm install", "clean-start": "npm run clean-install && npm start", "watch": "webpack --watch --progress --profile", "build": "rimraf dist && webpack --progress --profile --bail", "server": "webpack-dashboard -- webpack-dev-server --inline --port 8080", "dev": "webpack-dashboard -- webpack-dev-server --inline --port 8080", "webdriver-update": "webdriver-manager update", "webdriver-start": "webdriver-manager start", "lint": "tslint --force \"src/**/*.ts\"", "start": "npm run server", "start:hmr": "npm run server -- --hot", "postinstall": "npm run webdriver-update" }, "repository": { "type": "git", "url": "https://xxx.visualstudio.com/xxx/_git/xxx" }, "license": "UNLICENSED", "author": "xxx xxx", "dependencies": { "@angular/common": "2.4.9", "@angular/compiler": "2.4.9", "@angular/core": "2.4.9", "@angular/forms": "2.4.9", "@angular/http": "2.4.9", "@angular/platform-browser": "2.4.9", "@angular/platform-browser-dynamic": "2.4.9", "@angular/router": "3.4.9", "@angular/upgrade": "2.4.9", "@ng-bootstrap/ng-bootstrap": "^1.0.0-alpha.19", "@ngrx/core": "^1.2.0", "@ngrx/store": "^2.2.1", "angular-calendar": "^0.7.0", "angular2-google-maps": "^0.17.0", "angular2-tree-component": "3.1.0", "angular2-google-map-auto-complete": "^2.0.5", "angularfire2": "^2.0.0-beta.6", "bootstrap": "3.3.7", "core-js": "^2.4.1", "firebase": "^3.6.5", "font-awesome": "^4.6.1", "googlemaps": "^1.12.0", "jquery": "^2.2.4", "lodash": "^4.16.4", "moment": "2.0.0", "typings": "2.1.0", "ng2-auto-complete": "^0.10.5", "ng2-bs3-modal": "^0.10.4", "ng2-dnd": "^2.1.1", "ng2-translate": "^5.0.0", "ng2-webstorage": "^1.3.3", "rdash-ui": "^1.0.1", "reflect-metadata": "^0.1.3", "rxjs": "5.0.1", "systemjs": "0.19.27", "ts-xlsx": "0.0.8", "zone.js": "^0.7.2" }, "devDependencies": { "@angularclass/hmr": "^1.0.1", "@angularclass/hmr-loader": "^3.0.2", "@types/core-js": "^0.9.0", "@types/googlemaps": "^3.26.2", "@types/jasmine": "^2.2.29", "@types/jquery": "^2.0.33", "@types/node": "^7.0.8", "@types/selenium-webdriver": "3.0.0", "angular2-template-loader": "0.6.0", "autoprefixer": "^6.3.2", "awesome-typescript-loader": "^3.1.2", "copy-webpack-plugin": "^4.0.0", "css-loader": "^0.25.0", "extract-text-webpack-plugin": "^2.0.0-beta.4", "file-loader": "^0.9.0", "html-loader": "^0.4.0", "html-webpack-plugin": "^2.8.1", "istanbul-instrumenter-loader": "^0.2.0", "jasmine-core": "^2.3.4", "jasmine-spec-reporter": "^2.4.0", "json-loader": "^0.5.3", "node-sass": "^4.5.0", "null-loader": "0.1.1", "phantomjs-prebuilt": "^2.1.4", "postcss-loader": "^1.1.0", "protractor": "^4.0.10", "raw-loader": "0.5.1", "remap-istanbul": "^0.6.4", "rimraf": "^2.5.1", "sass-loader": " ^6.0.3", "shelljs": "^0.7.0", "style-loader": "^0.13.0", "ts-helpers": "^1.1.1", "ts-loader": "^2.0.1", "tslint": "^3.4.0", "tslint-loader": "^2.1.0", "typedoc": "^0.5.1", "typescript": "^2.0.0", "url-loader": "^0.5.6", "webpack": "^2.1.0-beta.25", "webpack-dashboard": "^0.3.0", "webpack-dev-server": " 2.4.2" } } 更新了角度2和更少的包裹, 如果我同时发送多个请求,我的一些请求会被取消,例如,如果有一些组的循环, 并且我想得到每个组的id并将其发送到服务器以便通过组ID得到一些东西,如果这个请求被无理由取消了。 如果我只是删除for并且自己放一些组ID并将其发送到服务器,一切正常。 互联网上没有任何关于这个问题的内容,这非常糟糕。 这是我的相关信息:

的package.json

this.loggedInUser.groups.forEach((group, key) => {
    this._RoutesService.getRoutesByGroupId(group.id).map((routes, key) => {
        console.log(routes);
        if (routes && routes.length > 0) {
            let n = 0;
            routes.forEach((router, key) => {
                if (router.stations) {
                    let rout = new route(router.name, router.id, group.id);
                    router.stations.forEach((state) => {
                        let statione = new station(state.id, state.latitude, state.longitude);
                        statione.users = state.users;
                        rout.Stations.push(statione);
                    });
                    this.RoutesList.push(rout);
                }
            });
        }
        i++;
        if (i == this.loggedInUser.groups.length) {
            this.setOriginDest();
        }
    }).subscribe();
});

包含请求的代码:

{{1}}

The cancelled requests

感谢..

0 个答案:

没有答案