我是Angular的新手,我使用$ http.jsonp从joomla网站获取一些json数据。
我只是在拉类别,即
<xsl:function name="wd:gePhone">
<xsl:param name="phone_number" />
<xsl:if test="$phone_number !=' '" >
<xsl:value-of select="normalize-space(replace(replace(replace(replace(replace(replace($phone_number,'-',''),'/',''),' ',''),'\)',''),'\(',''),'\+1',''))"/>
</xsl:if>
</xsl:function>
我正在尝试使用orderBy来组织这些类别:| ORDERBY: ' - 编号'“
这可行,但以奇怪的方式,输出为:1,10,100,2,23,200,3,34,300等。
显然不正确。
有没有解决这个问题?
答案 0 :(得分:1)
您需要更改服务器端的响应,因为您正在对数组进行排序-id
正在根据string
比较进行排序。将该字符串更改为数字(整数)将更有意义。而是使用过滤器并将其转换为整数然后进行排序,这不会被认为是一种好方法。
<强> JSON 强>
{
id: 89, //<-- this should be number instead of string
name: "Labour",
description: "<p>{module Labour Featured Stories}</p>",
image: "/media/k2/categories/",
language: "*",
parent: "87"
}
{
id: 90, //<-- this should be number instead of string
name: "International",
description: "<p>{module International Featured Stories}</p>",
image: "/media/k2/categories/",
language: "*",
parent: "87"
}