Angular starting point

by otupman

HTML

<div ng-controller="MyCtrl">
    <p>{{message}}</p>
    
    <button ng-click="doit()">do it, bitch</button>
</div>

JavaScript

var jsonp_callback = function() {
        console.log('callback');
    };
function MyCtrl($scope, $http) {
    $scope.message = "Hello, world";
   
    $scope.doit = function() {
        $http.jsonp('http://centralway.us7.list-manage.com/subscribe/post-json?u=84d2e06109ae0dc3c028e30c0&id=d7b7c0d751&[email protected]&c=JSON_CALLBACK')
        .success(function(result) {
            console.log('SUCCESS');
        })
        .error(function() {
           console.log('FAILED'); 
        });
    };
}

angular.module('mcDemo', [])
.config(function($httpProvider) {
    $httpProvider.defaults.useXDomain = true;
    delete $httpProvider.defaults.headers.common['X-Requested-With'];
})