<bdo id='g9pv4'></bdo><ul id='g9pv4'></ul>

      <small id='g9pv4'></small><noframes id='g9pv4'>

      1. <legend id='g9pv4'><style id='g9pv4'><dir id='g9pv4'><q id='g9pv4'></q></dir></style></legend>
      2. <tfoot id='g9pv4'></tfoot>
        <i id='g9pv4'><tr id='g9pv4'><dt id='g9pv4'><q id='g9pv4'><span id='g9pv4'><b id='g9pv4'><form id='g9pv4'><ins id='g9pv4'></ins><ul id='g9pv4'></ul><sub id='g9pv4'></sub></form><legend id='g9pv4'></legend><bdo id='g9pv4'><pre id='g9pv4'><center id='g9pv4'></center></pre></bdo></b><th id='g9pv4'></th></span></q></dt></tr></i><div id='g9pv4'><tfoot id='g9pv4'></tfoot><dl id='g9pv4'><fieldset id='g9pv4'></fieldset></dl></div>

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

        AngularJS $http.get returns undefined and $http() is not a function(AngularJS $http.get 返回 undefined 并且 $http() 不是函数)

        1. <i id='iiitu'><tr id='iiitu'><dt id='iiitu'><q id='iiitu'><span id='iiitu'><b id='iiitu'><form id='iiitu'><ins id='iiitu'></ins><ul id='iiitu'></ul><sub id='iiitu'></sub></form><legend id='iiitu'></legend><bdo id='iiitu'><pre id='iiitu'><center id='iiitu'></center></pre></bdo></b><th id='iiitu'></th></span></q></dt></tr></i><div id='iiitu'><tfoot id='iiitu'></tfoot><dl id='iiitu'><fieldset id='iiitu'></fieldset></dl></div>
          <legend id='iiitu'><style id='iiitu'><dir id='iiitu'><q id='iiitu'></q></dir></style></legend>

                <bdo id='iiitu'></bdo><ul id='iiitu'></ul>
              • <tfoot id='iiitu'></tfoot>
                  <tbody id='iiitu'></tbody>
              • <small id='iiitu'></small><noframes id='iiitu'>

                1. 本文介绍了AngularJS $http.get 返回 undefined 并且 $http() 不是函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在构建一个应用程序以在 AngularJS 中动态加载和显示数据库中的数据,但是当我尝试访问我的 API(使用 $http() 或 $http.get())时,我收到了错误.$http.get() error: TypeError: undefined is not a function, $http() error: TypeError: object is not a function

                  I'm building an app to dynamically load and display data from a database in AngularJS, but when I try to access my API (using either $http() or $http.get()), I receive errrors. $http.get() error: TypeError: undefined is not a function, $http() error: TypeError: object is not a function

                  此特定错误发生在动态加载导航选项卡的代码中.

                  This specific error occurs in the code to dynamically load navigation tabs.

                  CoffeeScript 中的代码:

                  The code for both in 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
                  ]
                  

                  有人看到我在这里做错了吗?

                  Does anyone see what I'm doing wrong here?

                  推荐答案

                  当使用数组表示法注入依赖时,参数的顺序很重要:

                  When using the array notation for injecting dependencies, the order of the arguments is important:

                  在您的代码中:

                  ['$routeParams',
                   '$scope',
                   '$http',
                   function ($http, $scope, $routeParams)  {
                      // $http argument        ==> $routeParams
                      // $scope argument       ==> $scope (by coincidence)
                      // $routeParams argument ==> $http
                  }
                  

                  所以,基本上,您正在执行 $routeParams.get(),但 $routeParams 没有方法 get()(也没有它本身就是一个函数).

                  So, basically, you are doing $routeParams.get(), but $routeParams has no method get() (nor is it a function itself).

                  这篇关于AngularJS $http.get 返回 undefined 并且 $http() 不是函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Rails/Javascript: How to inject rails variables into (very) simple javascript(Rails/Javascript:如何将 rails 变量注入(非常)简单的 javascript)
                  quot;Each child in an array should have a unique key propquot; only on first time render of page(“数组中的每个孩子都应该有一个唯一的 key prop仅在第一次呈现页面时)
                  Rails 3.1 ajax:success handling(Rails 3.1 ajax:成功处理)
                  CoffeeScript always returns in anonymous function(CoffeeScript 总是以匿名函数返回)
                  Ordinals in words javascript(javascript中的序数)
                  getFullYear returns year before on first day of year(getFullYear 在一年的第一天返回前一年)

                  <legend id='LkOaB'><style id='LkOaB'><dir id='LkOaB'><q id='LkOaB'></q></dir></style></legend>

                        <bdo id='LkOaB'></bdo><ul id='LkOaB'></ul>
                      • <tfoot id='LkOaB'></tfoot>
                            <i id='LkOaB'><tr id='LkOaB'><dt id='LkOaB'><q id='LkOaB'><span id='LkOaB'><b id='LkOaB'><form id='LkOaB'><ins id='LkOaB'></ins><ul id='LkOaB'></ul><sub id='LkOaB'></sub></form><legend id='LkOaB'></legend><bdo id='LkOaB'><pre id='LkOaB'><center id='LkOaB'></center></pre></bdo></b><th id='LkOaB'></th></span></q></dt></tr></i><div id='LkOaB'><tfoot id='LkOaB'></tfoot><dl id='LkOaB'><fieldset id='LkOaB'></fieldset></dl></div>
                              <tbody id='LkOaB'></tbody>

                            <small id='LkOaB'></small><noframes id='LkOaB'>