0

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

5
  • Double check for syntax errors. Are you minifying the code using any build tools? Commented Jun 5, 2016 at 10:55
  • @charlietfl sorry I don not get what you mean? Commented Jun 5, 2016 at 11:12
  • OK... tells me you aren't using build tools. Double check your code base for syntax errors and then check that all files are loading in dev tools network Commented Jun 5, 2016 at 11:14
  • @charlietfl I make this checks and didn't found syntax errors and all my files are loading correct Commented Jun 5, 2016 at 11:25
  • @charlietfl thanks for your time my problem was in $http.get("localhost:2421/api/alamakCore/GetSubscribtions") this path Commented Jun 5, 2016 at 13:52

1 Answer 1

1

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', []);
Sign up to request clarification or add additional context in comments.

3 Comments

I write this code in app.js in the first code part in question
thanks for your time my problem was in $http.get("localhost:2421/api/alamakCore/GetSubscribtions") this path
Is created in very first code block in question along with proper dependency array. That error will also get thrown for other non intuitive reasons

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.