由于基本href标记,带有路由的Angular2 RC5融合图表无法正常工作 [英] Angular2 RC5 Fusion Charts with routing not working because of base href tag

查看:61
本文介绍了由于基本href标记,带有路由的Angular2 RC5融合图表无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在路由中使用Angular2 rc5,所以我在 index.html 中编写了

  document.write('< base href ='+ document.location +'"/>') 

我在我的应用程序中使用融合图.

我在组件中的以下网址中有2个图表

/fusion1 图表在这里可以正常使用应用的默认网址

当我单击链接时,URL现在变为

/fusion2 在此处,图表无法正确显示,但会显示标签,但不会呈现调色板颜色.

如果我们在svg中看到填充网址,则会显示如下

  fill = url('localhost:8443/fusion1#588xr ___ 120_278_216__rgba_0_174_141_1_:0-rgba_0_174_141_1_:100') 

我的填充网址未采用必须采用的更新路线

localhost:8443/fusion2

任何帮助将不胜感激.

解决方案

提供 APP_BASE_HREF 而不是< base> 标签来配置路由器,则可以设置< base href ="..."> 独立于路由器.

 提供者:[{提供:APP_BASE_HREF,useValue:'/'}] 

另请参见 Angular 2路由器未设置基本href

I am using Angular2 rc5 with routing, So in index.html I wrote

document.write('<base href="' + document.location + '" />')

I am using fusion charts in my app.

I have 2 charts in following url in components

/fusion1 chart here works properly default url for app

and when I click on link the url becomes now

/fusion2 here chart won't render properly it displays labels but wont render palette colors.

If we see fill url in svg it displays like this

fill=url('localhost:8443/fusion1#588xr___120_278_216__rgba_0_174_141_1_:0-rgba_0_174_141_1_:100')

My fill url is not taking updated route url which has to take

localhost:8443/fusion2

any help will be appreciated.

解决方案

Provide APP_BASE_HREF instead of the <base> tag to configure the router, then you can set <base href="..."> independent of the router.

providers: [{provide: APP_BASE_HREF, useValue: '/'}]

See also Angular 2 router no base href set

这篇关于由于基本href标记,带有路由的Angular2 RC5融合图表无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆