Controller does not load Angular + RequireJS

1

I'm developing an architecture to work with Angular in a large application with MVC AspNet, in this application it will not be the Angular that will treat the routes, but rather AspNet, so in this architecture I will not have Angular routes.

All pages have their own entrypoint Ex: group.entrypoint.js, which is this snippet of code:

//Load common code that includes config, then load the app logic.
'use strict';

(function () {
    require(['./entrypoint'], function () {

        //Group Controller
        require(['./controllers/group.controller']);
    });
})();   

What goes into this global application entrypoint (entrypoint.js):

//Global EntryPoint

var paths = {
    global:      './',
    angular:     './assets/vendor/angular/' 
};

require.config({
    name: 'App EntryPoint',
    baseUrl: '',
    paths: {
        'config':           paths.global + 'config/config',
        'angular':          paths.angular + 'angular.min', 
        'angular-route':    paths.angular + 'angular-ui-router.min',
        'angular-sanitize': paths.angular + 'angular-sanitize.min'              
    },
    shim: {     
        'angular-route': {
            deps: ['angular'],
            exports: 'angular'
        },
        'angular-sanitize': {
            deps: ['angular'],
            exports: 'angular'
        },      
        angular: {
            exports : 'angular'
        }
    },
    deps: ['config']
});

Then I have this config (config.js):

'use strict';

define(['angular', 'angular-route', 'angular-sanitize'], function (angular, route, sanitize) {

    var app = angular.module('app', ['route', 'sanitize']);

    // Bootstrap Application
    angular.bootstrap(app);

    return app; 
});

Well, and in my controller I have this code snippet, the idea I want is to give a require in the Factory or Service when I need it and use it inside the controller:

'use strict';

define(['config'], function (app) {

    (function () {

        //Global Services
        var service = require(['./services/services']);

        //Group Factory
        var factory = require(['./factories/group.factory']);               

        app.controller('groupController', groupController);

        groupController.$inject = ['$scope', 'service', 'factory'];

        function groupController($scope, service, factory) {
            $scope.name = 'foo';
        }

        return groupController;

    })();   
});

Well what happens is that nothing happens, it goes through the group controller script, but does nothing, for example on the screen I have ng-controller="groupController as group" in the body tag, but it does not bind it controller, so I'd like to know what's really wrong? Or if this mode I'm doing is not the right one, too?

Has anyone ever had anything similar?

    
asked by anonymous 29.04.2015 / 23:57

0 answers