0

I'm trying to redirect to an external URL, i'm developing on localhost so i am getting localhost:4200/www.example.com, how can i solve this? thanks in advance

import { Component, OnInit } from '@angular/core';

@Component({
    selector: 'app-main',
    templateUrl: './main.component.html'
})

export class MainComponent implements OnInit {
    public title: string;

    constructor(){}

    ngOnInit(){
        window.location.href = 'www.example.com'
    }
}

0

1 Answer 1

6

You are miss http

window.location.href = 'http://www.example.com'
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.