nativescript app-无法读取getCookie null的属性

时间:2016-09-16 12:11:43

标签: angular nativescript typescript1.8

正在使用angular2和typescript开发nativescript应用程序。在构建应用程序时,它已成功完全构建,但http调用无法执行。我正在使用@angular:" 2.0.0"和nativescript-angular:" 0.6.0"。下面包括我的错误日志。有人请帮助我。提前致谢

com.tns.NativeScriptException: 
Calling js method onClick failed

Error: Error in login/login.html:7:77 caused by: Cannot read property 
'getCookie' of null
File:     
"/data/data/org.nativescript.groceries/files/app/tns_modules/@angular/core/bundles/core.umd.js, line: 9688, column: 20


StackTrace: 
Frame: function:'DebugAppView._rethrowWithContext',file:'/data/data/org.nativescript.groceries/files/app/tns_modules/@angular/core/bundles/core.umd.js', line: 9688, column: 21
Frame: function:'', file:'/data/data/org.nativescript.groceries/files/app/tns_modules/@angular/core/bundles/core.umd.js', line: 9701, column: 27
Frame: function:'', file:'/data/data/org.nativescript.groceries/files/app/tns_modules/nativescript-angular/renderer.js', line: 221, column: 26
Frame: function:'ZoneDelegate.invoke', file:'/data/data/org.nativescript.groceries/files/app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js', line: 190, column: 28
Frame: function:'NgZoneImpl.inner.inner.fork.onInvoke', file:'/data/data/o

的package.json

"dependencies": {
"@angular/core": "2.0.0",
"@angular/common": "2.0.0",
"@angular/compiler": "2.0.0",
"@angular/http": "2.0.0",
"@angular/platform-browser": "2.0.0",
"@angular/platform-browser-dynamic": "2.0.0",
"@angular/platform-server": "2.0.0",
"@angular/forms": "2.0.0",
"@angular/router": "3.0.0",
"email-validator": "1.0.4",
"everlive-sdk": "1.7.1",
"nativescript-angular": "0.6.0",
"nativescript-iqkeyboardmanager": "1.0.1",
"nativescript-social-share": "1.3.0",
"nativescript-unit-test-runner": "^0.3.3",
"rxjs": "5.0.0-beta.12",
"reflect-metadata": "^0.1.8",
"tns-core-modules": "2.2.1"
},

"devDependencies": {
"zone.js": "^0.6.21",
"babel-traverse": "6.8.0",
"babel-types": "6.8.1",
"babylon": "6.8.0",
"codelyzer": "0.0.28",
"filewalker": "0.1.2",
"jasmine-core": "^2.4.1",
"karma": "^1.2.0",
"karma-jasmine": "^1.0.2",
"karma-nativescript-launcher": "^0.4.0",
"lazy": "1.0.11",
"nativescript-dev-typescript": "^0.3.2",
"tslint": "^3.14.0",
"typescript": "^1.8.10"
}

的login.html

<StackLayout>
<Image src="res://logo_login" stretch="none" 
horizontalAlignment="center"></Image>

<TextField hint="Email Address" keyboardType="email"  
[(ngModel)]="user.email"
autocorrect="false" autocapitalizationType="none"></TextField>
<TextField hint="Password" secure="true" [(ngModel)]="user.password"> 
</TextField>

  

1 个答案:

答案 0 :(得分:0)

很可能问题与此处相同

  

https://github.com/NativeScript/nativescript-angular/issues/305

简而言之: 尝试更改所有&#34; HTTP_PROVIDERS&#34;到&#34; NS_HTTP_PROVIDERS&#34;