question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Http error with final release of angular2

See original GitHub issue

I’m trying to make an http request (post or get) but as soon as the functions is called the app closes and shows the error:

JS ERROR Error: Error in login/login.component.html:9:51 caused by: null is not an object (evaluating '_angular_platformBrowser.__platform_browser_private__.getDOM().getCookie')

I am injecting the http object in the constructor, I’m importing it in the NgModule, I don’t know what could it be… I have done this before in Angular2 rc4 but I’m not being able to do it now.

EDIT: I made a little improvement, I changed the HttpModule in the NgModule for NativeScriptHttpModule and now it doesn’t crash but enters in the function when an error occurs and shows: Response with status: 200 for URL: null

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:13

github_iconTop GitHub Comments

1reaction
gergderksoncommented, Sep 17, 2016

By default iOS doesn’t allow requests over non https, but you can enable it. You can add the following to your Info.plist under app_resources/iOS.

Note changing this file means you need to re build your app with tns build ios --emulator

See this issue https://github.com/NativeScript/NativeScript/issues/1881

1reaction
bnusseycommented, Sep 17, 2016

We had the exact same problem, you actually need to use this:

import { NativeScriptHttpModule } from "nativescript-angular/http";

Add that to your app.module.ts and into your imports

Read more comments on GitHub >

github_iconTop Results From Across the Web

"Error: Angular requires Zone.js prolyfill" - Stack Overflow
I have upgraded from RC4 to the Final release of Angular2. When I run npm start , the app is stuck on 'Loading...'...
Read more >
Angular version 2.0.0 released!! | juri.dev
After two years of intense development it has now been officially released.
Read more >
Server-side rendering (SSR) with Angular Universal
This engine's Promise callback returns the rendered page to the web server, which then forwards it to the client in the HTTP response....
Read more >
Testing Angular 2 Services and Http with Jasmine
Just checked in an update. It's good with the latest Angular 2 release too, so it's probably a coding error of some sort,...
Read more >
48 answers on StackOverflow to the most popular Angular ...
Importing lodash into angular2 + typescript application ... I've got the following error when launching my Angular app, even if the component is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found