我有这个控制器代码:
1. customer_vendor_tabs_registration_set_content
2. customer_vendor_tabs_profile_set_content
3. customer_vendor_tabs_profileother_set_content
这是html代码:
$scope.searchResult = [{title:"this is 1"},{title:"this is 2"}];
$scope.searchByTag = function()
{
$location.path("search");
var req = {
method: 'POST',
url: 'url',
headers: {
'Content-Type': "application/json"
},
data: searchFormService.getTagSearhReqData()
};
$http(req).then(function(d){
for(var i=0;i<d.data.length;i++)
{
$scope.searchResult.push(d.data[i]);
}
alert($scope.searchResult.length);
}, function(e){
});
}
最初显示 <div ng-repeat="data in searchResult">
{{data.title}}
</div>
&amp; title1
调用title2
时,searchByTag()
显示alert($scope.searchResult.length);
的新长度,表示新元素已添加到searchResult
,但未在html中更新。
答案 0 :(得分:0)
您的JSON结构就像那样
html