marcoslin / angularAMD

Facilitate use of RequireJS in AngularJS
http://marcoslin.github.io/angularAMD
MIT License
734 stars 171 forks source link

Reference error : angular is not defined #175

Open ashokkumar24 opened 8 years ago

ashokkumar24 commented 8 years ago

main.js

'use strict'; require.config( {

baseUrl : "",

paths : {

    "angular" : "client/assets/vendor/angular/angular.min",
    "angular-amd" : "client/assets/vendor/angularAMD/angularAMD.min",
    "ngload" : "client/assets/vendor/ng-load/ng-load",
    "ui-router" : "client/assets/vendor/angular-ui-router/release/angular-ui-router.min",
    "jquery" : "client/assets/vendor/jquery/dist/jquery.min",
    "bootstrap" : "client/assets/vendor/bootstrap/dist/js/bootstrap.min",
    "signupModule" : "client/signup/signup.application",
    "loginModule" : "client/login/login.application",
    "homeModule" : "client/home/home.application",
    "constant" : "client/core/constant"

},

shim : {

    "angular-amd" : [ "angular" ],
    'ngload' : [ 'angular-amd' ],
    "ui-router" : [ "angular"],
    "bootstrap" : [ 'jquery']

},

deps : [ 'app' ]

} );


App.js

define([
"angular-amd", 'jquery', 'bootstrap', "ui-router", "signupModule", "loginModule", "homeModule"

    ], function(angularAMD) {

            'use strict';
            var app = angular.module('app', [

                "ui.router",  
                "signup",
                "login",
                "home"

            ]);

            app.config([

                '$stateProvider',
                '$urlRouterProvider',

                function( $stateProvider, $urlRouterProvider ) {

                    $urlRouterProvider.otherwise( '/' );

                    //Route for home
                    $stateProvider.state( "home", {
                        url : '/',
                        views : {
                            '' : {
                                templateUrl: 'client/main.html'
                            },
                            'nav@home' : {
                                templateUrl : 'client/nav/view/nav.html', 
                            },
                            'body@home' : {
                                templateUrl : 'client/login/view/login.html',
                                controller : 'loginCtrl as login'
                            },
                            'footer@home' : {
                                templateUrl : 'client/signup/view/signup.html',
                                controller : 'signupCtrl as signup',
                            }
                        },
                        controllerUrl : 'ngload!signupModule',
                    });

                    //Home page route
                    $stateProvider.state("welcome", {

                        params: {'userObj': null},
                        url: '/welcome',
                        templateUrl: 'client/home/view/home.html',
                        controller: 'homeCtrl as home',
                        resolve: {
                                userObj: ['$stateParams', function($stateParams) {
                                    return $stateParams.userObj;
                                }]
                            },
                        controllerUrl: 'ngload!homeModule',

                    });

                }

            ]);

        return angularAMD.bootstrap( app );

});

I am getting Reference Error : Angular is not defined. Could you please help on this???