import { Component, OnInit } from '@angular/core';import {Router} from "@angular/router";
import { Injectable } from '@angular/core'; import { Http } from '@angular/http'; import 'rxjs/add/operator/map';
@Component({ selector: 'app-login', templateUrl: './login.component.html',}) @Injectable() export class LoginComponent implements OnInit { public http:Http;
constructor(private router: Router, http:Http) { http stuff this.http = http; } ngOnInit() { console.log("login.component - ngOnInit"); this.http// .get('http://localhost:8080/webserviceapp/info/person/1') //works fine .get('https://localhost:8443/webserviceapp/info/person/1') //need to get working .map(response => response.json()) .subscribe(response => { console.log("person data: " +JSON.stringify(response)); //this is not reached for https }); }
login(event){ console.log("login.component - login event");
event.preventDefault(); this.router.navigate(['/home']) }
}
- login.component - ngOnInitlogin.component.ts (26,7)
- ERROR Response with status: 0 for URL: null
- [object Object]: {_body: Object, headers: Object, ok: false, status: 0, statusText: ""...}_body: Objectbubbles: falsecancelable: falsecancelBubble: falsecurrentTarget: nulldefaultPrevented: falseeventPhase: 2isTrusted: truelengthComputable: falseloaded: 0returnValue: truesrcElement: Objecttarget: ObjectmsCaching: "auto"onabort: nullonerror: nullonload: nullonloadend: nullonloadstart: nullonprogress: nullonreadystatechange: nullontimeout: nullreadyState: 4response: ""responseText: ""responseType: ""responseURL: ""responseXML: nullstatus: 0statusText: ""timeout: 0upload: ObjectwithCredentials: false__proto__: Object__zone_symbol__errorfalse: null__zone_symbol__loadfalse: null__zone_symbol__xhrListener: function () { if (target.readyState === target.DONE) { // sometimes on some browsers XMLHttpRequest will fire onreadystatechange with // readyState=4 multiple times, so we need to check task state here if (!data.aborted && XMLHttpRequest[XHR_SCHEDULED] && task.state === SCHEDULED) { task.invoke(); } } }__zone_symbol__xhrSync: false__zone_symbol__xhrTask: Object__zone_symbol__xhrURL: "https://localhost:8443/webserviceapp/info/person/1"timeStamp: 33736014.718281954total: 0type: "error"__proto__: Objectheaders: Object_headers: Object_normalizedNames: Object__proto__: Objectok: falsestatus: 0statusText: ""type: 3url: null__proto__: Object
package com.bob.webserviceapp.config;
import org.springframework.context.annotation.Bean;import org.springframework.context.annotation.ComponentScan;import org.springframework.context.annotation.Configuration;import org.springframework.context.annotation.Import;import org.springframework.web.servlet.config.annotation.CorsRegistry;import org.springframework.web.servlet.config.annotation.EnableWebMvc;import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;import org.springframework.web.servlet.view.InternalResourceViewResolver;
@Configuration@ComponentScan("com.bob.webserviceapp")@Import(DBConfig.class)@EnableWebMvcpublic class AppConfig extends WebMvcConfigurerAdapter { @Bean public InternalResourceViewResolver viewResolver() { InternalResourceViewResolver resolver = new InternalResourceViewResolver(); resolver.setPrefix("/WEB-INF/view/"); resolver.setSuffix(".jsp"); return resolver; } @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { registry.addResourceHandler("/app-resources/**").addResourceLocations("/resources/"); }
@Override public void addCorsMappings(CorsRegistry registry) { registry.addMapping("/**"); } }
--
You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscribe@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.
--
Hi guys,I have the problem on my angular app. The problem is the non angular Js files are not working properly . It's working only after the refresh of pageThank you,Regards,Mughilan
On Jun 3, 2018 8:18 AM, "Sander Elias" <sande...@gmail.com> wrote:
Hi Bob,Hmm, did a google search on `https localhost edge` and got quite some results. I think you are right, and Edge doesn't like localhost to much. Did you try connection on ip?RegardsSander
--
You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+u...@googlegroups.com.
core.js:1448 ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'call' of undefinedTypeError: Cannot read property 'call' of undefined at __webpack_require__ (bootstrap:81) at Object../src/app/+auth/+login/login.component.ts (login-login-module.js:69) at __webpack_require__ (bootstrap:81) at Object../src/app/+auth/+login/login-routing.module.ts (login-login-module.js:15) at __webpack_require__ (bootstrap:81) at Object../src/app/+auth/+login/login.module.ts (login.component.ts:14) at __webpack_require__ (bootstrap:81) at $_lazy_route_resource lazy namespace object:47 at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (zone.js:388) at Object.onInvoke (core.js:4749) at __webpack_require__ (bootstrap:81) at Object../src/app/+auth/+login/login.component.ts (login-login-module.js:69) at __webpack_require__ (bootstrap:81) at Object../src/app/+auth/+login/login-routing.module.ts (login-login-module.js:15) at __webpack_require__ (bootstrap:81) at Object../src/app/+auth/+login/login.module.ts (login.component.ts:14) at __webpack_require__ (bootstrap:81) at $_lazy_route_resource lazy namespace object:47 at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (zone.js:388) at Object.onInvoke (core.js:4749) at resolvePromise (zone.js:814) at resolvePromise (zone.js:771) at zone.js:873 at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:421) at Object.onInvokeTask (core.js:4740) at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:420) at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:188) at drainMicroTaskQueue (zone.js:595)