Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I am trying to implement angularjs with requirejs

Here is my applicaiton.js file which loads initially

var config = {
    baseUrl: '/assets/',
    paths: {
        jquery: 'jquery',
        twitter: 'twitter',
        angular: 'angular',
        angularjs: 'angularjs',       # This is the directory
        app: 'app'
    },
    shim: {
        'twitter/bootstrap': {
            deps: ['jquery']
        },
        'angular': {
            exports: 'angular'
        },
        'app': {
            deps: ['jquery']
        }
    }
}

requirejs.config(config);

requirejs(['jquery', 'twitter/bootstrap', 'angularjs/app', 'app/common']);

Directory structure

Application.js
Angularjs/
    -controllers/
    -directives/
    -Services/
    -app.js

As startup angularjs/app.js will be initiated and my app.js contains

define('app', ['angular'], function(angular) {
    var app = angular.module('app', []);
    return app;
})

require(['app'], function(app) {
    app.controller('FirstController', function($scope) {
        $scope.message = 'hello';
    })
})  

While running getting the exception as

Failed to instantiate module app

Used this as reference link

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.