0

i am getting undefined variable inside subscribe.

import { AppSetting } from '../config/app-setting';

this.api.userLogin(this.loginForm.value.emailid,this.loginForm.value.password).subscribe(
    data => {
            this.router.navigateByUrl(AppSetting.BASE_URL+'/enquiry');
        },
      error => console.log('oops', error)
    );

this is my global class

export class AppSetting {
   public static BASE_URL='http://192.168.1.144:8080/';

}
Rathinavel
  • 31
  • 4

1 Answers1

2

You can't redirect because the router doesn't work like that. The router is internal to Angular, you don't have to provide the domain, protocole, port ... Only the path.

this.router.navigateByUrl('/enquiry');

If you wish to go to another website, this will be

window.location.href = 'http://...';