Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot Get App to Init #167

Open
stljeff1 opened this issue Mar 27, 2016 · 1 comment
Open

Cannot Get App to Init #167

stljeff1 opened this issue Mar 27, 2016 · 1 comment

Comments

@stljeff1
Copy link

Hi,

First, thanks for making this utility.

I have been unable to get my app to initialize after converting my app to utilize AngularAMD. I have no idea why its not working, and therefore, have no where to begin troubleshooting.

Essentially, my app.js file is loaded and parsed, but execution never happens

Here is my main.js
require.config({

baseUrl: "js/",

// alias libraries paths
paths: {
    'jquery': 'https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min',
    'bootstrap': 'http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min',
    'angular': 'https://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular',
    'angular-route': 'https://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular-route.min',
    'angularAMD': 'angularAMD'        
},

// Add angular modules that does not support AMD out of the box, put it in a shim
shim: {
      'angularAMD': ['angular'],
    'angular-route': ['angular'],
    'bootstrap': ['jquery']
},

// kick start application
deps: ['app']

});

Here is my app.js:
define(['angularAMD', 'angular-route', 'controllers/ctrlOne', 'controllers/ctrlTwo'], function(angularAMD) {
'use strict';
var app = angular.module('MyApp', ['ngRoute']);
console.log(app);
// yada yad yada
});

Can you tell me why that console.log() call never fires? I am using Firebug to set breakpoints where the yada yada yada comment is, but none of the code in the block executes. Can you see anything that I'm doing wrong?

@the-unsoul
Copy link

@stljeff1 is that all of the content of your app.js ?
If yes then you will need something like.

// config your app
app.config(/* your config goes here... */);

// code...

// bootstrap with angularAMD and return an object, so requireJS/angularAMD can use it later
return angularAMD.bootstrap(app);

Also I can see that you are calling angular in your app.js without define the alias in define() block or config global alias in shim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants