請問這樣為什么獲取不到httpdata,是因?yàn)楫惒降年P(guān)系嗎,該怎么解決?//父級app.directive('d1',function(){ return{ controller:function($scope,$sce,$http){ var _this = this; _this.httpdata = ''; $http.get('data/data.json') .success(function(data,state){ _this.httpdata = data.elements; }) .error(function(err,state){ alert(state) }); } }});//子級app.directive('d2',function(){return{ require:'^d1', link:function(scope,elements,attrs,cntIns){ console.log(cntIns.httpdata) }}
angualr父級指令里$http請求數(shù)據(jù)后子指令獲取不到
千巷貓影
2018-10-12 11:10:24