Javascript angularjs:$injector:moduler模块错误
这是我的app.jsJavascript angularjs:$injector:moduler模块错误,javascript,angularjs,Javascript,Angularjs,这是我的app.js (function () { app = angular.module('alamak', ['ngAnimate', 'ui.bootstrap', 'ngTagsInput', 'uiSwitch', 'colorpicker.module', 'wysiwyg.module', 'angularjs-dropdown-multiselect']) }()) 这是我的控制器 (function () { var alamakCore = func
(function () {
app = angular.module('alamak', ['ngAnimate', 'ui.bootstrap', 'ngTagsInput', 'uiSwitch', 'colorpicker.module', 'wysiwyg.module', 'angularjs-dropdown-multiselect'])
}())
这是我的控制器
(function () {
var alamakCore = function ($scope, $http) {
$scope.checklogin = function () {
$http.get("http://localhost:2421/api/alamakCore/GETLogin")
.success(function (res) {
debugger;
$scope.users = res;
$scope.msg = "Nada";
$("#notLogin").hide();
$("#LoginTab").show();
$("#userData").hide();
// $("#user_name").append(res.Username);
$(".lvl1.UserPhoto").prepend("<img src='/Images/1-1.jpg' class='img-responsive img-circle' /> ");
$("#SideBarNotLogined").hide();
$("#Searchtxt").on("keyup", function () {
var txt = $(this).val();
$("div[class='col-md-3 col-sm-6']").each(function () {
var sourcetxt = $(this).children("p[class='Home_SourceTitle']").text();
//var Newstxt = $(this).childeren("a[class='Home_NewsTitle']").text();
if (sourcetxt.toUpperCase().indexOf(txt.toUpperCase()) != -1) {
$(this).show();
}
else {
$(this).hide();
}
})
})
})
}
$scope.checklogin();
$scope.GetSubscription = function () {
$http.get("http://localhost:2421/api/alamakCore/GetSubscribtions")
.success(function (res) {
$scope.subscriptions = res;
})
}
$scope.getMychannels = function () {
$http.get("http://localhost:2421/api/alamakCore/GetMyChannels")
.success(function (res) {
$scope.MyChannels = res;
})
}
$scope.GetGategories = function () {
$http.get("http://localhost:2421/api/alamakCore/GetGategories")
.success(function (res) {
$scope.Gategories = res;
})
}
$scope.GetNews_Login = function () {
$http.get("http://localhost:2421/api/alamakCore/GetNews_Login")
.success(function (res) {
$scope.News = res;
})
}
$scope.GetSubscription();
$scope.GetGategories();
$scope.getMychannels();
$scope.GetNews_Login();
}
angular.module("alamak").controller("alamakCore", alamakCore);
}())
我的角度更大,所以我找不到缺失代码的位置。错误在于没有模块
alamak
。这是因为你没有创建它,你只是在创建它之前尝试获取它
下面是一个getter示例:
// This is a getter and requires a module that's already
// been created or an error will be thrown.
var module = angular.module('alamak')
您需要的是以下内容:
// Create a new module 'alamak' that takes a second parameter
// that is an array of dependencies.
angular.module('alamak', []);
仔细检查语法错误。你在使用任何构建工具缩小代码吗?@charlietfl抱歉我不明白你的意思?好的。。。告诉我您没有使用构建工具。仔细检查代码库中的语法错误,然后检查所有文件是否正在dev工具中加载network@charlietfl我进行了检查,没有发现语法错误,我的所有文件都在加载correct@charlietfl感谢您的时间,我的问题在$http.get(“)此路径我在问题的第一个代码部分在app.js中编写此代码感谢您的时间我的问题出现在$http.get(“localhost:2421/api/alamakCore/GetSubscribtions”)中此路径是在问题的第一个代码块中创建的,并带有适当的依赖项数组。由于其他非直观的原因,此错误也会被抛出
// This is a getter and requires a module that's already
// been created or an error will be thrown.
var module = angular.module('alamak')
// Create a new module 'alamak' that takes a second parameter
// that is an array of dependencies.
angular.module('alamak', []);