Angularjs 我能';不要将第三方js与angular js和ASP.NET MVC一起使用

Angularjs 我能';不要将第三方js与angular js和ASP.NET MVC一起使用,angularjs,asp.net-mvc,angularjs-injector,angular-route-segment,Angularjs,Asp.net Mvc,Angularjs Injector,Angular Route Segment,您好,我正在使用ASP.NET MVC和Angular js创建应用程序 一切都运行良好,但当我想使用任何第三方js的角度js它是不允许这样做 我已经创建了三个js文件 1) app.js var app; (function () { app = angular.module("ANG", []); app.factory('GlobalService', function () { return { urlBase: 'myservi

您好,我正在使用ASP.NET MVC和Angular js创建应用程序

一切都运行良好,但当我想使用任何第三方js的角度js它是不允许这样做

我已经创建了三个js文件

1) app.js

var app;
(function () {
    app = angular.module("ANG", []);

    app.factory('GlobalService', function () {
        return {
            urlBase: 'myserviceurl/',
            UserName: '',
            UserRole: ''
        };
    });
})();
   app.controller("CustomerCtrl", ["$scope", "$q", "VendorService", "CustomerService", "$filter", function ($scope, $q, vendorService, customerService, $filter){
       //My code here
}
]);
app.service('VendorService', ["$http", "$q", "GlobalService", function ($http, $q, globalService) {
//My service calling
}]);
app = angular.module("ANG", ["angularjs-dropdown-multiselect"]);
2) Controller.js

var app;
(function () {
    app = angular.module("ANG", []);

    app.factory('GlobalService', function () {
        return {
            urlBase: 'myserviceurl/',
            UserName: '',
            UserRole: ''
        };
    });
})();
   app.controller("CustomerCtrl", ["$scope", "$q", "VendorService", "CustomerService", "$filter", function ($scope, $q, vendorService, customerService, $filter){
       //My code here
}
]);
app.service('VendorService', ["$http", "$q", "GlobalService", function ($http, $q, globalService) {
//My service calling
}]);
app = angular.module("ANG", ["angularjs-dropdown-multiselect"]);
3) Service.js

var app;
(function () {
    app = angular.module("ANG", []);

    app.factory('GlobalService', function () {
        return {
            urlBase: 'myserviceurl/',
            UserName: '',
            UserRole: ''
        };
    });
})();
   app.controller("CustomerCtrl", ["$scope", "$q", "VendorService", "CustomerService", "$filter", function ($scope, $q, vendorService, customerService, $filter){
       //My code here
}
]);
app.service('VendorService', ["$http", "$q", "GlobalService", function ($http, $q, globalService) {
//My service calling
}]);
app = angular.module("ANG", ["angularjs-dropdown-multiselect"]);
4) 在视图中实施

<html lang="en" id="htmlMainPage" ng-app="ANG">
它运行得也很好,但是其他也使用过这个app.js的页面给了我一个错误


只需查看您给出的js的引用即可

您必须在布局页面中提供参考或添加multiselect.js,因为正如您在问题中所述,您是如何实现app.js的

<html lang="en" id="htmlMainPage" ng-app="ANG">

每次加载和查找multiselect.js引用的任何视图时,它都会调用该函数,并给出喷油器错误信息,不再进一步


参考:

您在哪里提供了multiselect js的参考?在查看页面中,我指的是我只需要在页面中的位置。哦,是的,我在布局中添加了multiple.js,它现在正在运行。谢谢,不客气。确保当您在angular js中使用任何第三方js时,如果您正在使用app.js,其中您只实现了一次模块,并且如果您在每个页面上使用不同的js(app.js代表模块),那么请将其放在布局中,而不仅仅是在该视图上提供参考。