RESTful

happy!

by dream apple

HTML

<div ng-app="MyApp">
    <div ng-controller="MyController">
        {{data}}
    </div>
</div>

JavaScript

angular.module("MyApp", [])
.config(function($httpProvider){
    $httpProvider.defaults.headers.common["X-AVOSCloud-Application-Id"] = "rjrzlrq7wr8e252pbqms8ficcyh0kmihv6pahgvszhee6j4x";
    $httpProvider.defaults.headers.common["X-AVOSCloud-Application-Key"] = "j4ew7s9ssdz7ls72am6ex4yq7r8ql3sntj184cgdhkcb7qku";
    $httpProvider.defaults.headers.common["Content-Type"] = "application/json";
})
.controller("MyController", function($scope, $http){
    $scope.data = "hello";
    $http({
        method: "GET",
        url: "https://leancloud.cn/1.1/classes/hello/55702ec7e4b008cbbbdc49ec"
    })
    .success(function(data){
        console.log(data);
    })
    .error(function(error){
        console.log(error);
    });
});