I'm starting to use angular.js, I'm studying a Tutorial (Definitive Guide to Learn AngularJS in One Day) , but at first I already had problems with the $ http request. I'm getting the message: $ http is not defined
In the Index header I include:
<script src="http://code.angularjs.org/1.0.1/angular-1.0.1.min.js"></script>
MyHTML:
{%verbatim%}<ulclass="dropdown-menu" ng-controller="sbMenuTopSupport">
<li ><a href="{{support.action.uri}}">{{support.action.label}}</a></li>
<li class="divider"></li>
<li>
</li>
</ul>
{% endverbatim %}
My javascript:
<script type="text/javascript">
var sbMenuTop = angular.module('sbMenuTop', []);
sbMenuTop.controller('sbMenuTopSupport', ['$scope', function ($scope) {
$scope.support = {};
$scope.support.action = {
"uri": "/SBSystem/web/app_dev.php/support/status.json",
"label": "Unavailable"
};
$scope.support.access = {
"ipaddress": null,
"username": null,
"password": null
};
$http({
method: 'GET',
url: $scope.support.action.uri
}).sucess(function (data, status, headers, config) {
$scope.support = data;
//recuperação de dados bem sucedida
}).error(function (data, status, headers, config) {
//alguma erro ocorreu :(
});
}]);
</script>
These are the error messages I receive:
ReferenceError: $http is not defined
at new <anonymous> ((index):128)
at d (angular-1.0.1.min.js:27)
at Object.instantiate (angular-1.0.1.min.js:27)
at $get (angular-1.0.1.min.js:50)
at angular-1.0.1.min.js:42
at m (angular-1.0.1.min.js:6)
at k (angular-1.0.1.min.js:42)
at e (angular-1.0.1.min.js:38)
at e (angular-1.0.1.min.js:38)
at e (angular-1.0.1.min.js:38)