package.json
{
"name": "angular-quickstart",
"version": "1.0.0",
"description": "QuickStart package.json from the documentation, supplemented with testing support",
"scripts": {
"start": "tsc && concurrently \"tsc -w\" \"lite-server\" ",
"e2e": "tsc && concurrently \"http-server -s\" \"protractor protractor.config.js\" --kill-others --success first",
"lint": "tslint ./app/**/*.ts -t verbose",
"lite": "lite-server",
"pree2e": "webdriver-manager update",
"test": "tsc && concurrently \"tsc -w\" \"karma start karma.conf.js\"",
"test-once": "tsc && karma start karma.conf.js --single-run",
"tsc": "tsc",
"tsc:w": "tsc -w"
},
"keywords": [],
"author": "",
"license": "MIT",
"dependencies": {
"@angular/common": "~2.4.0",
"@angular/compiler": "~2.4.0",
"@angular/core": "~2.4.0",
"@angular/forms": "~2.4.0",
"@angular/http": "~2.4.0",
"@angular/platform-browser": "~2.4.0",
"@angular/platform-browser-dynamic": "~2.4.0",
"@angular/router": "~3.4.0",
"angular-in-memory-web-api": "~0.2.2",
"core-js": "^2.4.1",
"mydatepicker": "^1.1.12",
"ng2-datepicker": "^1.4.7",
"reflect-metadata": "^0.1.8",
"rxjs": "5.0.1",
"systemjs": "0.19.40",
"zone.js": "^0.7.4"
},
"devDependencies": {
"concurrently": "^3.1.0",
"lite-server": "^2.2.2",
"typescript": "~2.0.10",
"canonical-path": "0.0.2",
"http-server": "^0.9.0",
"tslint": "^3.15.1",
"lodash": "^4.16.4",
"jasmine-core": "~2.4.1",
"karma": "^1.3.0",
"karma-chrome-launcher": "^2.0.0",
"karma-cli": "^1.0.1",
"karma-jasmine": "^1.0.2",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~4.0.14",
"rimraf": "^2.5.4",
"@types/node": "^6.0.46",
"@types/jasmine": "^2.5.36"
},
"repository": {}
}
用于从数据库中获取数据
getQuestionList() {
this.headers = new Headers();
this.headers.append('Content-Type', 'application/json; charset=utf-8');
let options = new RequestOptions({
method: RequestMethod.Post,
url: "FeedbackMaster.aspx/getQuestionList",
headers: this.headers,
body:{log:this.login}
});
return this._http.request(new Request(options)).retry(2)
.map((response: Response)=>this.extractData(response))
.do(data => {this.temp=data, console.log('getQuestionList:'+ JSON.stringify(JSON.parse(this.temp.d)))})
.catch(this.handleError);
}
Question.ts
QuestionList() {
this.dataService.getQuestionList().subscribe(
tradeshows => {
this.temoobj = tradeshows,
this.QuestionMaster = JSON.parse(this.temoobj.d);
},
error => { console.error('QuestionList:\n\t ' + error); }
);
}
当我尝试在新浏览器上运行应用程序时
第一次从数据库获取数据需要40秒的时间
同样的浏览器第二次尝试时只需要3到4秒
为什么第一次加载时间需要40秒才能在很短的时间内加载我尝试多次然后没问题它需要我几秒钟
然后
why this problem occurs in first time loading for new browser ?
what is solution for that?