2016-09-13 24 views
0

如何的var apiMatch = '/api/Customer'string變量相匹配的JSON響應對象來自API調用如何搭配可變字符串JSON響應對象

JSON對象看起來像下面

enter image description here

我的圖像認爲它會很簡單做類似

if(data.paths == apiMatch) { 
    // Do something here when its matched 
    console.log('its matched'); 
} else { 
    console.log('Nothing'); 
} 

回答

0

你的問題不是cl耳。你想從地址欄獲取網址嗎?

如果是的話,你可以嘗試$location

+0

不是要獲取URL,我想apiPath的'的URL參數值相匹配=「」'是'/ API/Customer'我的JSON響應上圖中顯示的對象。 – nCore

+0

重寫我的問題。 – nCore