-2
我有了一個REST功能是這樣的:如何從services.js調用REST函數?
@Override
public String getNameForMW() {
String MW_Url = props.getProperty("MW_Url"); //<<this returns a String
return MW_Url.split("/")[3].toString();
}
然後,我有一個接口:
@GET
@Produces(MediaType.TEXT_PLAIN)
@Path("/getNameForMW")
public String getNameForMW();
然後我有services.js文件,其中我廠的所在地,並有這一行:
var pathForMW = $http.get(path + 'getNameForMW');
可以幫我嗎?
我需要它是一個簡單的字符串,我蘆葦從屬性文件
這是......角度...?你知道'$ http.get'不會立即返回*結果,但你必須註冊一個*異步回調* ...? – deceze
不......我應該怎麼做? – newbie
https://docs.angularjs.org/api/ng/service/$http – deceze