{"id":434,"date":"2017-02-18T16:21:40","date_gmt":"2017-02-18T08:21:40","guid":{"rendered":"http:\/\/www.qdabc.cn\/?p=434"},"modified":"2017-02-18T16:21:40","modified_gmt":"2017-02-18T08:21:40","slug":"angularjs%e8%8e%b7%e5%8f%96%e5%a4%a9%e6%b0%94%e9%a2%84%e6%8a%a5%e6%a1%88%e4%be%8b","status":"publish","type":"post","link":"http:\/\/www.qdabc.cn\/?p=434","title":{"rendered":"AngularJS\u83b7\u53d6\u5929\u6c14\u9884\u62a5(\u6848\u4f8b)"},"content":{"rendered":"<pre class=\"brush:html;toolbar:false\">&lt;!DOCTYPE html&gt;  \r\n&lt;html&gt;  \r\n&lt;head&gt;  \r\n    &lt;meta charset=\"UTF-8\"&gt;  \r\n    &lt;title&gt;\u5929\u6c14\u9884\u62a5&lt;\/title&gt;  \r\n&lt;\/head&gt;  \r\n&lt;body ng-app=\"Weather\"&gt;  \r\n      \r\n    &lt;div ng-controller=\"WeatherController\"&gt;  \r\n        &lt;table&gt;  \r\n            &lt;tr ng-repeat=\"weather in weatherData\"&gt;  \r\n                &lt;td&gt;{{weather.date}}&lt;\/td&gt;  \r\n                &lt;td&gt;{{weather.temperature}}&lt;\/td&gt;  \r\n                &lt;td&gt;{{weather.weather}}&lt;\/td&gt;  \r\n                &lt;td&gt;{{weather.wind}}&lt;\/td&gt;  \r\n                &lt;td&gt;&lt;img ng-src=\"{{weather.dayPictureUrl}}\" alt=\"\"&gt;&lt;\/td&gt;  \r\n                &lt;td&gt;&lt;img ng-src=\"{{weather.nightPictureUrl}}\" alt=\"\"&gt;&lt;\/td&gt;  \r\n            &lt;\/tr&gt;  \r\n        &lt;\/table&gt;  \r\n    &lt;\/div&gt;  \r\n  \r\n    &lt;script src=\".\/libs\/angular.min.js\"&gt;&lt;\/script&gt;  \r\n    &lt;script&gt;  \r\n              \r\n        var Weather = angular.module('Weather', []);  \r\n  \r\n        Weather.controller('WeatherController', ['$scope', '$http', function ($scope, $http) {  \r\n  \r\n            $http({  \r\n                url: 'http:\/\/api.map.baidu.com\/telematics\/v3\/weather',  \r\n                method: 'jsonp',  \r\n                params: {  \r\n                    location: '\u5317\u4eac',  \r\n                    output: 'json',  \r\n                    ak: '0A5bc3c4fb543c8f9bc54b77bc155724',  \r\n                    callback: 'JSON_CALLBACK'  \r\n                }  \r\n            }).success(function (info) {  \r\n  \r\n                \/\/ console.log(info);  \r\n  \r\n                $scope.weatherData = info.results[0].weather_data;  \r\n  \r\n            });  \r\n                      \r\n  \r\n        }]);  \r\n  \r\n    &lt;\/script&gt;  \r\n&lt;\/body&gt;  \r\n&lt;\/html&gt;<\/pre>\n<p class=\"post-copyright\">\u6b22\u8fce\u5206\u4eab\u672c\u6587\uff0c\u8f6c\u8f7d\u8bf7\u4fdd\u7559\u51fa\u5904\uff1a<a href=\"http:\/\/www.qdabc.cn\">\u524d\u7aefABC<\/a> &raquo; <a href=\"http:\/\/www.qdabc.cn\/?p=434\">AngularJS\u83b7\u53d6\u5929\u6c14\u9884\u62a5(\u6848\u4f8b)<\/a><\/p>","protected":false},"excerpt":{"rendered":"<p>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;meta charset=&#8221;UTF-8&#8243;&gt; &lt;title&gt;\u5929\u6c14\u9884\u62a5&lt;\/t [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":20,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[53,100],"_links":{"self":[{"href":"http:\/\/www.qdabc.cn\/index.php?rest_route=\/wp\/v2\/posts\/434"}],"collection":[{"href":"http:\/\/www.qdabc.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.qdabc.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.qdabc.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.qdabc.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=434"}],"version-history":[{"count":1,"href":"http:\/\/www.qdabc.cn\/index.php?rest_route=\/wp\/v2\/posts\/434\/revisions"}],"predecessor-version":[{"id":435,"href":"http:\/\/www.qdabc.cn\/index.php?rest_route=\/wp\/v2\/posts\/434\/revisions\/435"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.qdabc.cn\/index.php?rest_route=\/wp\/v2\/media\/20"}],"wp:attachment":[{"href":"http:\/\/www.qdabc.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=434"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.qdabc.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=434"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.qdabc.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=434"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}