我撞到了另一面墙!现在已经好几个小时了.
我有一个从购物车系统的JSON文件中提取的产品列表.
当客户将产品添加到购物车时,我想要刷新JSON Feed,因为我已将其设置为根据客户在购物车中的内容调整库存水平,因此他们无法添加太多产品,而商店不会有.
'加入购物车'运作良好.但我无法弄清楚如何"推送"更新的Feed来更新DOM元素.
这是我到目前为止:
$scope.reloadData = function(detailSection) {
// Find the URL title of the current click product
var prod_detail_url = $scope.products[detailSection].url_title;
var prod_category_id = $scope.products[detailSection].discount_category;
var prod_sku = $scope.products[detailSection].title;
// Set the defaults of the info to load in
var detailurl = '/order/series_detail/' + prod_detail_url + '/' + prod_category_id + '/' + prod_sku;
$scope.productDetail = [];
// Process the details of the product
$scope.reloadedDetails = function (data, status) {
$scope.productDetail = data;
$scope.productDetail.push(data);
$('.detailloader').hide();
}
// Fetch the Details of the product
$scope.reloadDetail = function () {
$('.detailloader').show();
$http.get(detailurl).success($scope.reloadedDetails);
}
// Instantiate the process
$scope.reloadDetail();
};
Run Code Online (Sandbox Code Playgroud)
$ scope.reladedDetail正在开火,我的.detailloader正在显示.据我所见,从检查器中可以看到它的URL.$ scope.reloadedDetails,但它没有推送新数据并隐藏.detailloader.
我相信'在提交后我还需要再次制作'原始'形式?我还没有适当地调查过这个问题.目前的测试允许我添加一个东西到购物车,但如果我然后添加尝试添加另一个,表单不提交.
有什么建议吗?我可以告诉Angular在新数据加载后再次使表单保持原始状态吗?我不确定我的杆子是否正确.
非常感谢您抽出宝贵时间提供帮助.
| 归档时间: |
|
| 查看次数: |
17454 次 |
| 最近记录: |