亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

angular里我設置了一個默認值,在獲取后臺數據后默認值怎樣去掉覆蓋???

kitchenApp.controller('HomeCtrl',?function?($scope,$http,?$stateParams,?$state)?{ ????????$http({ ??????????????method:?'GET', ??????????????url:?'http://rest.ilefe.cn/rest/product/read_list' ??????????}).then(function?successCallback(response)?{ ?????????? ??????????????????$scope.data?=?response.data.data; ????????console.log(response.data.data); ??????????},?function?errorCallback(response)?{ ????????????alert("沒有獲取到"); ????????}); ????$scope.fetch1?=?function()?{ ????????$(function()?{ ????????????$(".list-title?ul?>?li").click(function()?{ ????????????????$(this).addClass("finger").siblings().removeClass("finger"); ????????????}); ????????}); ????????$http({ ??????????????method:?'GET', ??????????????url:?'http://rest.ilefe.cn/rest/product/read_list' ??????????}).then(function?successCallback(response)?{ ?????????? ??????????????????$scope.data?=?response.data.data; ????????console.log(response.data.data); ??????????},?function?errorCallback(response)?{ ????????????alert("沒有獲取到"); ????????}); ??????}; ??????$scope.fetch2?=?function()?{ ????????$(function()?{ ????????????$(".list-title?ul?>?li").click(function()?{ ????????????????$(this).addClass("finger").siblings().removeClass("finger"); ????????????}); ????????}); ????????$http({ ??????????????method:?'GET', ??????????????url:?'http://rest.ilefe.cn/rest/product/readlist/category_id/6' ??????????}).then(function?successCallback(response)?{ ?????????? ??????????? ????????????? ??????????????????$scope.data?=?response.data.data; ????????console.log(response.data.data); ??????????},?function?errorCallback(response)?{ ????????????alert("沒有獲取到"); ????????}); ??????}; ??????$scope.fetch3?=?function()?{ ????????$(function()?{ ????????????$(".list-title?ul?>?li").click(function()?{ ????????????????$(this).addClass("finger").siblings().removeClass("finger"); ????????????}); ????????}); ????????$http({ ??????????????method:?'GET', ??????????????url:?'http://rest.ilefe.cn/rest/product/readlist/category_id/7' ??????????}).then(function?successCallback(response)?{ ??????????????????$scope.data?=?response.data.data; ????????console.log(response.data.data); ??????????},?function?errorCallback(response)?{ ????????????alert("沒有獲取到"); ????????}); ??????}; ????});
查看完整描述

1 回答

?
e生態

TA貢獻1條經驗 獲得超1個贊

遍歷你覆蓋的數據就可以

如果是集合采用 ?ng-replace="item in items"自動處理

查看完整回答
1 反對 回復 2016-06-28
  • Nola_jun
    Nola_jun
    如果點擊了對item點擊,怎么默認綁定第一個值
  • 1 回答
  • 0 關注
  • 2538 瀏覽

添加回答

了解更多

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號