Skip to content

Instantly share code, notes, and snippets.

@bclinkinbeard
Created January 28, 2014 18:17
Show Gist options
  • Select an option

  • Save bclinkinbeard/8673123 to your computer and use it in GitHub Desktop.

Select an option

Save bclinkinbeard/8673123 to your computer and use it in GitHub Desktop.
Why doesn't this work? AngularJS 1.2.10
angular.module('app', ['ngMockE2E'])
.run(function ($httpBackend) {
$httpBackend.whenGET('/some/url').respond({foo: 'bar'});
})
.controller('Ctrl', function ($scope, $http) {
$http.get('/some/url')
.then(function (result) {
$scope.msg = result.foo;
});
});
<!DOCTYPE html>
<html ng-app="app">
<head>
<title></title>
</head>
<body>
<div ng-controller="Ctrl">
{{ msg }}
</div>
<script type="text/javascript" src="vendor/angular.js"></script>
<script type="text/javascript" src="vendor/angular-mocks.js"></script>
<script type="text/javascript" src="app.js"></script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment