小编Rog*_*che的帖子

AngularJS $ http.get返回undefined,$ http()不是函数

我建立一个应用程序来动态地从数据库中AngularJS加载和显示数据,但是当我尝试访问我的API(使用$ HTTP()或$ http.get()),我收到errrors.$ http.get()错误:TypeError: undefined is not a function,$ http()错误:TypeError: object is not a function

代码中出现此特定错误,以动态加载导航选项卡.

CoffeeScript中的代码:

p4pControllers.controller 'navCtrl', [
    '$routeParams'
    '$scope'
    '$http'
    ($http,$scope,$routeParams) ->
        $http(
        method:'GET'
        url:'http://p4p-api.snyx.nl/tables'
    ).success (data) ->
        $scope.tabs = data
        return
    return

    $http.get('http://p4p-api.snyx.nl/tables').success (data) ->
       $scope.tabs = data
       return
    return
]
Run Code Online (Sandbox Code Playgroud)

有谁看到我在这里做错了什么?

javascript coffeescript angularjs

7
推荐指数
1
解决办法
1万
查看次数

标签 统计

angularjs ×1

coffeescript ×1

javascript ×1