marcoslin / angularAMD

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

Controller method getting fired repeatedly/ Infinitely , Page getting unresponsive #174

Open hkumar102 opened 8 years ago

hkumar102 commented 8 years ago

I am trying to use angularAMD with ASP.Net MVC , Controller is getting loaded but after that the controller function is firing again again , making page unresponsive . I am attaching the files , please guide me where i am i doing wrong.

main.js require.config({ baseUrl: "/Scripts", paths: { "angular": "angular/angular", "ngRoute": "angular-route/angular-route", "angularAMD" : "angularAMD/angularAMD", "app": "app" }, shim: { "ngRoute": ["angular"], "angularAMD": ["angular"] }, deps: ["app/app"] });

app.js define(["ngRoute", "angularAMD"], function (ngRoute, angularAMD) { debugger;

var app = angular.module("BigLynx", ["ngRoute"])
.config(function ($routeProvider, $controllerProvider,
            $compileProvider, $filterProvider, $provide, $httpProvider) {

    debugger;
    app.register =
        {
            controller: $controllerProvider.register,
            directive: $compileProvider.directive,
            filter: $filterProvider.register,
            factory: $provide.factory,
            service: $provide.service
        };
    $routeProvider
        .when('/home', angularAMD.route({
            templateUrl: '/home/index', controller: 'homeController',
            controllerUrl: 'app/controllers/homeController'
        }))
        .otherwise({ redirectTo: '/home' });
})
.run(function () {

});

return angularAMD.bootstrap(app);

})

//homeController js

'use strict' define(['app/app'], function (app) { debugger;

app.controller('homeController', function ($scope) {
    debugger
    $scope.message = "Message from HomeCtrl";
});

});