即使在注入http之后,Uncaught TypeError: Cannot read property 'ge
Even after injection of http, Uncaught TypeError: Cannot read property 'get' of undefined
我有以下简单的代码,但我得到的错误,即使$http注入:
angular.module('bizapp')
.controller('SalesCtrl', ['$scope', '$http', GetSalesInvoices]);
function GetSalesInvoices($scope, $http) {
$scope.invoices = [];
$scope.refresh = function($scope, $http) {
var url = "https://foo.ic/api/salesinvoice/SalesInvoices";
$http.get(url)
.success(function(data) {
$scope.invoices = data.d.results;
})
.error(function(){
console.log('opss')
})
.finally(function() {
$scope.$broadcast('scroll.refreshComplete');
});
}
}
Uncaught TypeError: Cannot read property 'get' of undefined我错过了什么?
您的控制器中已经有$scope
和$http
,因此您不需要将它们作为参数传递给功能refresh
。把
$scope.refresh = function($scope, $http) {
$scope.refresh = function() {
应该都能正常运行
相关文章:
- 未捕获TypeError: Cannot read property 'geocode'未定义的'
- SailsJs中的错误.TypeError: Cannot read property '的定义
- 未捕获的TypeError: Cannot read property 'top'的定义
- 未捕获的TypeError: Cannot read property '未定义的数据表
- 未捕获的TypeError: Cannot read property 'timing'的定义
- 未捕获的TypeError: Cannot read property 'checked'零
- 未捕获的TypeError: Cannot read property 'top'在引导中单击导航栏时未
- Extjs5 treepanel [Uncaught TypeError: Cannot read property &
- TypeError: Cannot read property 'submit'添加到购物车'
- 添加自定义jquery.验证方法导致Uncaught TypeError: Cannot read property &
- Vue 2和Vue- resource [Cannot read property 'get'未定义的(
- asp:textbox Uncaught TypeError: Cannot read property 'va
- TypeError: Cannot read property 'search' of undefine
- 读取json时出错未捕获类型错误:Cannot read property 'output'的定义
- 未捕获的TypeError: Cannot read property 'current'在选择任何选项
- 未捕获的TypeError: Cannot read property '3'的定义
- jquery-ui.js:12443未捕获的TypeError: Cannot read property 'a
- jquery Uncaught TypeError: Cannot read property 'left
- 未捕获类型错误:Cannot read property 'print'的定义
- TokenInput + Uncaught TypeError: Cannot read property 't