jquery - Why can't the angularjs data be rendered on the page? The data is obtained, what's wrong with my code?
漂亮男人
漂亮男人 2017-05-15 17:10:07
0
3
587

I use jquery to request data and want to render it on the page through angularjs...!

漂亮男人
漂亮男人

reply all(3)
世界只因有你

After obtaining the data, apply it to force refresh. I also encountered it a few days ago, and I don't know why. . .

$scope.weather = responseData.data;
$scope.$apply();

================================Supplement================== ===================

After some research in the past two days, it seems that promises other than angularjs are used to make data requests, and angularjs cannot monitor it. Your code uses $.ajax(), so you need to force a refresh. If you use $http.get() to request data, you should not need $apply to refresh.

Also, can you send out your API interface? Just what I need!

仅有的幸福

http://www.angularjs.cn/A0a6
You need $apply

淡淡烟草味

You can try this, initialize $scope.weather = {}; at the beginning of the controller function

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template