GVKun编程网logo

javascript – 未捕获TypeError:回调不是函数(未捕获通过反射调用的方法)

14

如果您想了解javascript–未捕获TypeError:回调不是函数和未捕获通过反射调用的方法的知识,那么本篇文章将是您的不二之选。我们将深入剖析javascript–未捕获TypeError:回

如果您想了解javascript – 未捕获TypeError:回调不是函数未捕获通过反射调用的方法的知识,那么本篇文章将是您的不二之选。我们将深入剖析javascript – 未捕获TypeError:回调不是函数的各个方面,并为您解答未捕获通过反射调用的方法的疑在这篇文章中,我们将为您介绍javascript – 未捕获TypeError:回调不是函数的相关知识,同时也会详细的解释未捕获通过反射调用的方法的运用方法,并给出实际的案例分析,希望能帮助到您!

本文目录一览:

javascript – 未捕获TypeError:回调不是函数(未捕获通过反射调用的方法)

javascript – 未捕获TypeError:回调不是函数(未捕获通过反射调用的方法)

我有一个功能:

reportAdminActions.reportMemberList(project,function(data) {
    console.log(data);
});

此函数由另一个ajax操作调用,如下所示:

reportMemberList: function(projectId,callback) {
    var projectDetail = new Object();
    projectDetail.projectId = projectId;
    var pluginArrayProject = new Array();
    pluginArrayProject.push(projectDetail);   
    $.ajax({
        url : ConfigCom.serverUrl + 'projectreportonmember',dataType: "jsonp",type: "POST",data: JSON.stringify(pluginArrayProject)
    }).always(function(data) {
        callback(data.responseText);
    });
}

在ajax操作之后我需要返回值到函数定义区域.但在这里我得到了一个错误

Uncaught TypeError: callback is not a function

解决方法

检查代码的其余部分是否有对reportMemberList的调用,并确保始终使用回调作为参数调用它.如果在任何地方省略回调参数(例如,只调用带有projectId参数的reportMemberList),上面的代码将正确解析其他对函数的调用将产生错误. (这是我的解决方案.)

javascript – Angular JS TypeError:$http不是函数

javascript – Angular JS TypeError:$http不是函数

我已经阅读了所有帖子,其中人们得到这个问题,其中$http不是一个函数,并且看起来大多数情况下它是由于以错误的顺序进行注入.

我的模块定义如下所示:

angular.module("app",[]).controller("appCtrl",['$scope','$http',function ($scope,$http) {

...

    $scope.makeCall= function ($http) {
         console.log("HERE");
         $http({ method: 'GET',url: <url }).
            then(function (response) {

                console.log(response.data);
                return response.data;
            },function (response) {

        });
    };
}
])

任何建议将不胜感激.

解决方法

从makeCall函数中删除$http参数,这会消除通过控制器注入的$http依赖性的存在.基本上,当您在函数上添加它时,它被设置为undefined
$scope.makeCall= function () { //<-- removed $http dependency from here
   console.log("HERE");
   $http({ method: 'GET',url: 'url' })
      .then(function (response) {
            console.log(response.data);
            return response.data;
      },function (response) {

      }
   );
};

javascript – BackboneJs:未捕获TypeError:undefined不是函数

javascript – BackboneJs:未捕获TypeError:undefined不是函数

我遇到的问题是Stack中有很多其他帖子.但是没有人能解决这个问题所以我正在解决这个问题.

快速参考:
Uncaught TypeError: undefined is not a function rails3/backbone/js

我正在用backBoneJs编写我的第一个应用程序.这是我遵循的例子:

http://www.jamesyu.org/2011/01/27/cloudedit-a-backbone-js-tutorial-by-example/

当我执行代码时:

1 - Uncaught TypeError: Cannot call method 'extend' of undefined (Controller 1ºline)

2 - Uncaught TypeError: undefined is not a function              (app 6º line)
App.initapp.js:6
(anonymous function)/backbone/#:32
f.extend._Deferred.e.resolveWithjquery-1.6.4.min.js:2
e.extend.readyjquery-1.6.4.min.js:2
c.addEventListener.C

检查我的代码:

的index.html

<html>
    <head>
        <title></title>
        <link href="css/style.css" media="all" rel="stylesheet" type="text/css" />
    </head>

    <body>
        <h1><a href="#">Editor de Documentos</a></h1>
        <h2>Backbone + PHP by Lqdi</h2>

        <div id="notice"></div>
        <div id="app"></div>
        <script type="text/javascript" src="js/_libs/jquery-1.6.4.min.js"></script>
        <script type="text/javascript" src="js/_libs/json2.js"></script>
        <script type="text/javascript" src="js/_libs/underscore.js"></script>
        <script type="text/javascript" src="js/_libs/backbone.js"></script>
        <script type="text/javascript" src="js/_libs/jquery.dotimeout.js"></script>

        <script type="text/javascript" src="js/app.js"></script>

        <script type="text/javascript" src="js/controllers/documents.js"></script>
        <script type="text/javascript" src="js/models/document.js"></script>
        <script type="text/javascript" src="js/collections/documents.js"></script>


        <script type="text/javascript" src="js/views/edit.js"></script>
        <script type="text/javascript" src="js/views/index.js"></script>
        <script type="text/javascript" src="js/views/notice.js"></script>

        <script type="text/javascript">
            $(function() {
                App.init();
            });
        </script>
    </body>
</html>

类别:

App.Collections.Documents = Backbone.Collection.extend({
    model: Document,
    url: '/documents'
});

控制器:

App.Controllers.Documents = Backbone.Controller.extend({
    routes: {
        "documents/:id":            "edit",
        "":                         "index",
        "new":                      "newDoc"
    },

    edit: function(id) {
        var doc = new Document({ id: id });
        doc.fetch({
            success: function(model, resp) {
                new App.Views.Edit({ model: doc });
            },
            error: function() {
                new Error({ message: 'Could not find that document.' });
                window.location.hash = '#';
            }
        });
    },

    index: function() {
        var documents = new App.Collections.Documents();
        documents.fetch({
            success: function() {
                new App.Views.Index({ collection: documents });
            },
            error: function() {
                new Error({ message: "Error loading documents." });
            }
        });
    },

    newDoc: function() {
        new App.Views.Edit({ model: new Document() });
    }
});

楷模:

var Document = Backbone.Model.extend({
    url : function() {
      var base = 'documents';
      if (this.isNew()) return base;
      return base + (base.charat(base.length - 1) == '/' ? '' : '/') + this.id;
    }
});

浏览次数:

edit.js

App.Views.Edit = Backbone.View.extend({
    events: {
        "submit form": "save"
    },

    initialize: function() {
        _.bindAll(this, 'render');
        this.model.bind('change', this.render);
        this.render();
    },

    save: function() {
        var self = this;
        var msg = this.model.isNew() ? 'Successfully created!' : "Saved!";

        this.model.save({ title: this.$('[name=title]').val(), body: this.$('[name=body]').val() }, {
            success: function(model, resp) {
                new App.Views.Notice({ message: msg });
                Backbone.history.saveLocation('documents/' + model.id);
            },
            error: function() {
                new App.Views.Error();
            }
        });

        return false;
    },

    render: function() {
        $(this.el).html(JST.document({ model: this.model }));
        $('#app').html(this.el);

        // use val to fill in title, for security reasons
        this.$('[name=title]').val(this.model.get('title'));

        this.delegateEvents();
    }
});

index.js

App.Views.Index = Backbone.View.extend({
    initialize: function() {
        this.render();
    },

    render: function() {
        $(this.el).html(JST.documents_collection({ collection: this.collection }));
        $('#app').html(this.el);
    }
});

notice.js

 App.Views.Notice = Backbone.View.extend({
        className: "success",
        displayLength: 5000,
        defaultMessage: '',

        initialize: function() {
            _.bindAll(this, 'render');
            this.message = this.options.message || this.defaultMessage;
            this.render();
        },

        render: function() {
            var view = this;

            $(this.el).html(this.message);
            $(this.el).hide();
            $('#notice').html(this.el);
            $(this.el).slideDown();
            $.doTimeout(this.displayLength, function() {
                $(view.el).slideUp();
                $.doTimeout(2000, function() {
                    view.remove();
                });
            });

            return this;
        }
    });

    App.Views.Error = App.Views.Notice.extend({
        className: "error",
        defaultMessage: 'Uh oh! Something went wrong. Please try again.'
    });

该应用程序:

var App = {
    Views: {},
    Controllers: {},
    Collections: {},
    init: function() {
        new App.Controllers.Documents();
        Backbone.history.start();
    }
};

解决方法:

如果您使用的是主干0.5.x,则将Backbone.Controller重命名为Backbone.Router

从文档:

Upgrading to 0.5.0+

We’ve taken the opportunity to clarify some naming with the 0.5.0 release. Controller is Now Router, and refresh is Now reset. The prevIoUs saveLocation and setLocation functions have been replaced by navigate. Backbone.sync’s method signature has changed to allow the passing of arbitrary options to jQuery.ajax. Be sure to opt-in to pushState support, if you want to use it.

javascript – Boostrap Popover错误:未捕获TypeError:undefined不是函数

javascript – Boostrap Popover错误:未捕获TypeError:undefined不是函数

我得到一个未捕获的TypeError:undefined不是我网站的一个页面上的函数.该功能在所有其他页面上都可以正常运行.它有点冗长的页面代码,因此我只会在必要时发布它,但这里是基础知识.

弹出窗口的按钮:

<buttonid="help" type="button" data-toggle="popover" data-trigger="focus"  data-html="true" data-placement="bottom" title="ActiveMLS Documentation" data-content="<small><p><strong>List Custom Property Listings</strong></p></small>"><i></i></button>

错误

Uncaught TypeError: undefined is not a function shell.js:23

来自shell.js第23行的jquery

/*******************************/
/*  POPOVER HELPER
/*******************************/
$(document).ready(function(){
   $('#help').popover()
});

我很困惑,为什么它只在这个页面上打破?

<!-- blueimp gallery styles -->
<link rel="stylesheet" href="/static/uploadlib/css/blueimp-gallery.min.css">
<!-- CSS to style the file input field as button and adjust the Bootstrap progress bars -->
<link rel="stylesheet" href="/static/uploadlib/css/jquery.fileupload-ui.css">
<div>
    <div>
        <div>
            <div>
                <buttonid="help" type="button" data-toggle="popover" data-trigger="focus"  data-html="true" data-placement="bottom" title="ActiveMLS Documentation" data-content="<small><p><strong>List Custom Property Listings</strong> - The list Custom Property listings page is an overview of all the Custom Property listings listings and information displayed on the website frontend</p><ul><li><strong>Add Custom Property Listings</strong> - Shortcut to the <em>Add Custom Property Listings</em> page.</li><li><strong>Records Per Page</strong> - display any list 10, 25, 50, or 100 records at a time.</li><li><strong>Search</strong> - Search any list by keyword(s).</li><li><strong>Listing ID</strong> - The Custom Property ID of the Custom Property listing.</li><li><strong>Address</strong> - The address of the Custom Property listing.</li><li><strong>Edit Custom Property Listing</strong> - Access the <em>Edit Custom Property Listing</em> page for this listing.</li><li><strong>Delete Custom Property Listing</strong> - Access the <em>Delete Custom Property Listing</em> page for this listing.</li></ul></small>"><i></i></button>
                <!-- TMPL_IF add_mode -->
                <h1>Add Custom Property Listing</h1>
                <!-- /TMPL_IF -->
                <!-- TMPL_IF edit_mode -->
                <h1>Edit Custom Property Listing</h1>
                <!-- /TMPL_IF -->
                <!-- TMPL_IF delete_mode -->
                <h1>Delete Custom Property Listing</h1>
                <!-- /TMPL_IF -->
            </div>
        </div>
        <form id="fileupload" method="post" action="<!-- TMPL_VAR request_path -->">
            <div>
                <!-- TMPL_IF error_message -->
                    <divhttps://www.jb51.cc/tag/dis/" target="_blank">dismissable" role="alert" >
                        <button type="button"data-dismiss="alert"><span aria-hidden="true">&times;</span><span>Close</span></button>
                        Warning!<br />
                        <!-- TMPL_VAR error_message ESCAPE=0 -->
                    </div>
                <!-- /TMPL_IF --> 
            </div>
            <div>
                <fieldset>
                    <div>
                        <label>Listing Category</label>
                        <!-- TMPL_VAR category ESCAPE=0 -->
                    </div>
                    <div>
                        <label>Listing ID</label>
                        <!-- TMPL_VAR listing_id ESCAPE=0 -->
                    </div>
                    <div>
                        <label>Agent Name</label>
                        <!-- TMPL_VAR l_ag1_id ESCAPE=0 -->
                    </div>
                </fieldset>
            </div>
            <hr />
            <div>
                <fieldset>
                    <div>
                        <label>Price</label>
                        <!-- TMPL_VAR price ESCAPE=0 -->
                    </div>
                    <div>
                        <div>
                            <label>Street Address</label>
                            <!-- TMPL_VAR street_no ESCAPE=0 --> <!-- TMPL_VAR street ESCAPE=0 -->
                        </div>
                    </div> 
                    <div>
                        <label>City</label>
                        <!-- TMPL_VAR city ESCAPE=0 -->
                    </div>
                    <div>
                        <label>State</label>
                        <!-- TMPL_VAR state ESCAPE=0 -->
                    </div>
                    <div>
                        <label>Zip Code</label>
                        <!-- TMPL_VAR zip ESCAPE=0 -->
                    </div>
                </fieldset>
            </div>
            <hr />
            <div>
                <fieldset>
                    <div>
                        <label>Description</label>
                        <!-- TMPL_VAR remarks_general ESCAPE=0 -->
                    </div>
                </fieldset>
            </div>
            <hr />
            <div>
                <fieldset>
                    <div>
                        <label>Business Type</label>
                        <!-- TMPL_VAR business_type ESCAPE=0 -->
                    </div>
                    <div>
                        <label>For Lease</label>
                        <!-- TMPL_VAR for_lease_yn ESCAPE=0 -->
                    </div>
                    <div>
                        <label>For Sale</label>
                        <!-- TMPL_VAR for_sale_yn ESCAPE=0 -->
                    </div>
                    <div>
                        <label>Parcel Type</label>
                        <!-- TMPL_VAR parcel_type ESCAPE=0 -->
                    </div>
                    <div>
                        <label>Area</label>
                        <!-- TMPL_VAR area_desc ESCAPE=0 -->
                    </div>
                    <div>
                        <label>County</label>
                        <!-- TMPL_VAR county ESCAPE=0 -->
                    </div>
                    <div>
                        <label>School district</label>
                        <!-- TMPL_VAR schools_d ESCAPE=0 -->
                    </div>
                    <div>
                        <label>Elementary School</label>
                        <!-- TMPL_VAR schools_e ESCAPE=0 -->
                    </div>
                    <div>
                        <label>High School</label>
                        <!-- TMPL_VAR schools_h ESCAPE=0 -->
                    </div>
                    <div>
                        <label>Year Built</label>
                        <!-- TMPL_VAR year_built ESCAPE=0 -->
                    </div>
                    <div>
                        <label>Type</label>
                        <!-- TMPL_VAR type ESCAPE=0 -->
                    </div>
                    <div>
                        <label>Rooms</label>
                        <!-- TMPL_VAR no_rooms ESCAPE=0 -->
                    </div>
                    <div>
                        <label>bedrooms</label>
                        <!-- TMPL_VAR bdrms ESCAPE=0 -->
                    </div>
                    <div>
                        <label>Baths, Full</label>
                        <!-- TMPL_VAR baths_full ESCAPE=0 -->
                    </div>
                    <div>
                        <label>Baths, Half</label>
                        <!-- TMPL_VAR baths_part ESCAPE=0 -->
                    </div>
                    <div>
                        <label>Approx. Sq. Ft.</label>
                        <!-- TMPL_VAR sqft ESCAPE=0 -->
                    </div>
                    <div>
                        <label>Approx. Lot Size</label>
                        <!-- TMPL_VAR lot_size ESCAPE=0 -->
                    </div>
                    <div>
                        <label>Approx. Acre</label>
                        <!-- TMPL_VAR acres ESCAPE=0 -->
                    </div>
                    <div>
                        <label>Foundation</label>
                        <!-- TMPL_VAR foundation ESCAPE=0 -->
                    </div>
                    <div>
                        <label>Exterior</label>
                        <!-- TMPL_VAR exterior ESCAPE=0 -->
                    </div>
                    <div>
                        <label>Heating</label>
                        <!-- TMPL_VAR heating ESCAPE=0 -->
                    </div>
                    <div>
                        <label>Cooling</label>
                        <!-- TMPL_VAR cooling ESCAPE=0 -->
                    </div>
                    <div>
                        <label>Fuel</label>
                        <!-- TMPL_VAR heat_fuel ESCAPE=0 -->
                    </div>
                    <div>
                        <label>Parking Spaces</label>
                        <!-- TMPL_VAR gar_prk_no ESCAPE=0 -->
                    </div>
                    <div>
                        <label>Sewer</label>
                        <!-- TMPL_VAR sewer ESCAPE=0 -->
                    </div>
                    <div>
                        <label>Water</label>
                        <!-- TMPL_VAR water ESCAPE=0 -->
                    </div>
                    <div>
                        <label>Fireplace</label>
                        <!-- TMPL_VAR fireplace ESCAPE=0 -->
                    </div>
                    <div>
                        <label>Tax 1</label>
                        <!-- TMPL_VAR tax_1 ESCAPE=0 -->
                    </div>
                    <div>
                        <label>Tax 2</label>
                        <!-- TMPL_VAR tax_2 ESCAPE=0 -->
                    </div>
                    <div>
                        <label>Six Month Tax</label>
                        <!-- TMPL_VAR six_mo_taxes ESCAPE=0 -->
                    </div>
                </fieldset>
            </div>
            <hr />
        <!-- TMPL_IF delete_mode -->
            <p>
            <!-- TMPL_LOOP Thumbnails -->
            <img src="/custom_prop/photo_thumbnail?filename=<!-- TMPL_VAR filename -->">
            <!-- /TMPL_LOOP -->
            </p>
        <!-- TMPL_ELSE -->
        <!-- Start Upload -->
        <noscript><p>JavaScript is required for photo upload.</p></noscript>
        <input type="hidden" name="nonce" value="<!-- TMPL_VAR nonce -->"/>
            <!-- The fileupload-buttonbar contains buttons to add/delete files and start/cancel the upload -->
                <divhttps://www.jb51.cc/tag/buttonbar/" target="_blank">buttonbar">
                    <div>
                        <!-- The fileinput-button span is used to style the file input field as button -->
                        <span>
                            <i></i>
                            <span>Add photos...</span>
                            <input type="file" name="files" multiple>
                        </span>
                        <button type="submit">
                            <i></i>
                            <span>Start upload</span>
                        </button>
                        <button type="reset">
                            <i></i>
                            <span>Cancel upload</span>
                        </button>
                        <button type="button">
                            <i></i>
                            <span>Delete</span>
                        </button>
                        <!-- The loading indicator is shown during file processing -->
                        <span></span>
                    </div>
                    <!-- The global progress information -->
                    <div>
                        <!-- The global progress bar -->
                        <divrole="progressbar" aria-valuemin="0" aria-valuemax="100">
                            <div></div>
                        </div>
                        <!-- The extended global progress information -->
                        <div>&nbsp;</div>
                    </div>
                </div>
                <!-- The table listing the files available for upload/download -->
                <table role="presentation"><tbody></tbody></table>
                <!-- The blueimp gallery widget -->
                <div id="blueimp-gallery"https://www.jb51.cc/tag/gal/" target="_blank">gallery blueimp-gallery-controls" data-filter=":even">
                    <div></div>
                    <h3></h3>
                    <a>‹</a>
                    <a>›</a>
                    <a>×</a>
                    <a></a>
                    <ol></ol>
                </div>
            <!-- /TMPL_IF -->
          <div>
                <div>
                <!-- TMPL_IF edit_mode -->
                <input type="submit" name="submit"value="Save"/>
                <input type="submit" name="cancel"value="Cancel"/>
                <!-- /TMPL_IF -->
                <!-- TMPL_IF add_mode -->
                <input type="submit" name="submit"value="Save"/>
                <input type="submit" name="cancel"value="Cancel"/>
                <!-- /TMPL_IF -->
                <!-- TMPL_IF delete_mode -->
                <p>Are you sure you want to delete this listing?</p>
                <input type="submit" name="confirm"value="Yes"/>
                <input type="submit" name="cancel"value="No"/>
                <!-- /TMPL_IF -->
            </div>
          </div>
        </form>
    </div>
</div>


<!-- The template to display files available for upload -->
<script id="template-upload" type="text/x-tmpl">
{% for (var i=0, file; file=o.files[i]; i++) { %}
    <tr>
        <td>
            <span></span>
        </td>
        <td>
            <p>{%=file.name%}</p>
            {% if (file.error) { %}
                <div><span>Error</span> {%=file.error%}</div>
            {% } %}
        </td>
        <td>
            <p>{%=o.formatFileSize(file.size)%}</p>
            {% if (!o.files.error) { %}
                <divrole="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valueNow="0"><div></div></div>
            {% } %}
        </td>
        <td>
            {% if (!o.files.error && !i && !o.options.autoUpload) { %}
                <button>
                    <i></i>
                    <span>Start</span>
                </button>
            {% } %}
            {% if (!i) { %}
                <button>
                    <i></i>
                    <span>Cancel</span>
                </button>
            {% } %}
        </td>
    </tr>
{% } %}
</script>
<!-- The template to display files available for download -->
<script id="template-download" type="text/x-tmpl">
{% for (var i=0, file; file=o.files[i]; i++) { %}
    <tr>
        <td>
            <span>
                {% if (file.thumbnailUrl) { %}
                    <a href="{%=file.url%}" title="{%=file.name%}" download="{%=file.name%}" data-gallery><img src="{%=file.thumbnailUrl%}"></a>
                {% } %}
            </span>
        </td>
        <td>
            <p>
                <a href="{%=file.url%}" title="{%=file.name%}" download="{%=file.name%}" {%=file.thumbnailUrl?'data-gallery':''%}>{%=file.name%}</a>
            </p>
            {% if (file.error) { %}
                <div><span>Error</span> {%=file.error%}</div>
            {% } %}
        </td>
        <td>
            <span>{%=o.formatFileSize(file.size)%}</span>
        </td>
        <td>
            <buttondata-type="{%=file.deleteType%}" data-url="{%=file.deleteUrl%}"{% if (file.deleteWithCredentials) { %} data-xhr-fields='{"withCredentials":true}'{% } %}>
                <i></i>
                <span>Delete</span>
            </button>
        </td>
    </tr>
{% } %}
</script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<!-- The jQuery UI widget factory, can be omitted if jQuery UI is already included -->
<script src="/static/uploadlib/js/vendor/jquery.ui.widget.js"></script>
<!-- The Templates plugin is included to render the upload/download listings -->
<script src="/static/uploadlib/js/tmpl.min.js"></script>
<!-- The Load Image plugin is included for the preview images and image resizing functionality -->
<script src="/static/uploadlib/js/load-image.min.js"></script>
<!-- blueimp gallery script -->
<script src="/static/uploadlib/js/jquery.blueimp-gallery.min.js"></script>
<!-- The Iframe Transport is required for browsers without support for XHR file uploads -->
<script src="/static/uploadlib/js/jquery.iframe-transport.js"></script>
<!-- The basic File Upload plugin -->
<script src="/static/uploadlib/js/jquery.fileupload.js"></script>
<!-- The File Upload processing plugin -->
<script src="/static/uploadlib/js/jquery.fileupload-process.js"></script>
<!-- The File Upload image preview & resize plugin -->
<script src="/static/uploadlib/js/jquery.fileupload-image.js"></script>
<!-- The File Upload validation plugin -->
<script src="/static/uploadlib/js/jquery.fileupload-validate.js"></script>
<!-- The File Upload user interface plugin -->
<script src="/static/uploadlib/js/jquery.fileupload-ui.js"></script>
<!-- The main application script -->
<script>
$(function () {
    'use strict';
    // Initialize the jQuery File Upload widget:
    $('#fileupload').fileupload({
        url: '/custom_prop/file_upload_handler?nonce=<!-- TMPL_VAR nonce -->'
    });
        // Load existing files:
        $('#fileupload').addClass('fileupload-processing');
        $.ajax({
            url: $('#fileupload').fileupload('option', 'url'),
            dataType: 'json',
            context: $('#fileupload')[0]
        }).always(function () {
            $(this).removeClass('fileupload-processing');
        }).done(function (result) {
            $(this).fileupload('option', 'done')
                .call(this, null, {result: result});
        });
});
</script>
<!-- End Upload -->

解决方法:

还有其他事情需要检查.

如果在jquery.js之前包含bootstrap.js,也可能导致这种情况.
因此,请确保在引导之前包含jQuery.

就我而言,问题如下:

实际上我正在使用pre-jQuery Rails,所以当我包含Bootstrap JS文件时,我不认为包含与它们捆绑的jQuery版本会导致任何问题,但是当我删除那个JS文件时,一切都开始完美.

Also one more possible case is, there Could be multiple instances of
jQuery in the page. So search for a duplicate version of jQuery and
remove them if there is any.

这是一个很好看的链接.

Avoiding Conflicts with Other Libraries

javascript – Firebase:未捕获TypeError:Firebase不是构造函数

javascript – Firebase:未捕获TypeError:Firebase不是构造函数

我无法为我的生活找出为什么我不能让Firebase在这个应用程序中工作.我不断得到错误:
Uncaught TypeError: Firebase is not a constructor

当我有:

var Firebase = require("firebase");
var ref = new Firebase("https://letspretendthisisreal.firebaseio.com");

我使用电子和耻辱我知道…我没有使用Angular,因为我只是构建一个简单的应用程序,只有我的使用.我花了很多时间试图在网上找到答案,没有运气.你是我唯一的希望!

解决方法

最近firebase更新了他们的Web SDK,改变了一些API.你使用的语法看起来像2.x API,而3.x却是截然不同的.检查你的package.json以查看你正在使用哪个版本.如果是3.x,请参阅 the new docs site关于如何使用新的API初始化firebase.

关于javascript – 未捕获TypeError:回调不是函数未捕获通过反射调用的方法的介绍现已完结,谢谢您的耐心阅读,如果想了解更多关于javascript – Angular JS TypeError:$http不是函数、javascript – BackboneJs:未捕获TypeError:undefined不是函数、javascript – Boostrap Popover错误:未捕获TypeError:undefined不是函数、javascript – Firebase:未捕获TypeError:Firebase不是构造函数的相关知识,请在本站寻找。

本文标签: