Reputation: 65
this is my app.js
(function () {
app = angular.module('alamak', ['ngAnimate', 'ui.bootstrap', 'ngTagsInput', 'uiSwitch', 'colorpicker.module', 'wysiwyg.module', 'angularjs-dropdown-multiselect'])
}())
and this is my controller
(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);
}())
and this is my master page and the links i used it
<link rel="stylesheet" id="normalize-css" href="~/css/normalize.css?ver=1.0" media="all">
<script type="text/javascript" src="~/js/lib/conditionizr-4.3.0.min.js?ver=4.3.0"></script>
<script type="text/javascript" src="~/js/lib/modernizr-2.7.1.min.js?ver=2.7.1"></script>
<script type="text/javascript" src="~/js/lib/jquery.js"></script>
<script src="~/js/jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="~/js/lib/jquery-migrate.min.js"></script>
<link href="~/css/angular-ui-switch.css" rel="stylesheet" />
<script src="~/js/angular.min.js"></script>
<script src="~/js/angular-route.js"></script>
<script src="~/js/angular-animate.js"></script>
<script src="~/js/ui-bootstrap-tpls-1.3.3.min.js"></script>
<script src="~/app/app.js"></script>
<script src="~/app/JsControllers/3alamkCoreController.js"></script>
and i call ng-app and ng-controller in body tag then i get this error in browser
Uncaught Error: [$injector:modulerr] http://errors.angularjs.org/1.5.5/$injector/modulerr?p0=alamak&p1=Error%3A%…at%20c%20(http%3A%2F%2Flocalhost%2F3alamak%2Fjs%2Fangular.min.js%3A21%3A19)
I am a bigger in angular so I can not find where the missing code
Upvotes: 0
Views: 1002
Reputation: 14620
The error is complaining that there is no module alamak
. This is because you don't create it, you just try and get it before you've created it.
Here is an example of a 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')
And what you need is the following:
// Create a new module 'alamak' that takes a second parameter
// that is an array of dependencies.
angular.module('alamak', []);
Upvotes: 1