简体   繁体   English

重定向外部 URL Angular

[英]Redirect external URL Angular

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?我正在尝试重定向到外部 URL,我正在 localhost 上开发,所以我得到 localhost:4200/www.example.com,我该如何解决这个问题? 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' } }

You are miss http你是小姐 http

window.location.href = 'http://www.example.com'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM