2017-06-17 37 views
0

嘿,我是新的angular2,我试图得到这样的响应url。角2响应URL获取记录的字符不是在一个字符串

.map(res => res.url); --this is in my service 

.subscribe(data => { 
for (let entry of data){ 
    this.test = entry; 

,当我登录测试看起来像这样我的网址:

h2 home.component.ts:35 
t home.component.ts:35 
p home.component.ts:35 
:2 home.component.ts:35 

等你明白了吧,所以这是为什么? 我只想获得响应的普通网址供以后使用。 感谢

+0

你想要的应用程序的当前URL – Sajeetharan

+0

没有,我做一个GET请求和响应有一个网址我想, – benonymus

回答

1

你可以直接得到这样的,没有必要的因为在那里,

.map(res => res.url); 
.subscribe(data => { 
    this.test = data ; 
} 
+0

谢谢!将接受作为答案,我可以:D – benonymus

+0

@benonymus酷!高兴 – Sajeetharan