5

I have generated an angular project with yeomon (yo angular). I did some coding and tested if I could build the project (with grunt) properly. Result came out in the dist folder and it worked perfectly. Now I've coded some more (about 1000 rows) and I once again built the project. This time the browser shows nothing. No error in console. Index.html is correct and the minified js-files also seems ok.

I've added a proxy in Gruntfile.js otherwise I don't think I've done anything with it.

Any idea what can be the cause of this? How do I debug this most efficiently? Only way I can think of is to deactive everything and then acitvate module, build project, activate one more and so on. Will take a lot of time.

Update I've narrowed it down. I have a few resolves. If I remove them, then the view loads. I'm using ui-router. Can this be to any more help to resolove the issue?

.state('app', {
        url: '/app',
        resolve: {
          //medias: ['MultiProductsLoader', function(ProductsLoader) {
          //  return new ProductsLoader();
          //}]
        },
        views: {
          'inputView': {
            templateUrl: 'views/input.html',
            controller: 'AppCtrl'
          }
        }

Update2 My question was a bit unclear. The app worked perfectly when the project was in "develop mode", unminified. But when I built/minified the project, the app failed to laod without any error message. Se answer below for the solution.

Joe
  • 4,274
  • 32
  • 95
  • 175

2 Answers2

6

Solved!

I added this to the uglify options in Gruntfile.js

  options: {
    report: 'min',
    mangle: false
  }

You can read more about it here were I found the answear: Angular.module minification bug

Community
  • 1
  • 1
Joe
  • 4,274
  • 32
  • 95
  • 175
  • 1
    Ok! That worked for me too but maybe you could provide some summary explaination about your solution. The link you suggest is very full of many solutions. Why did this work? – TrtG Apr 07 '15 at 20:21
0

If a resolve cannot be resolved by ui-router, then the view(s) defined in the state will not be rendered, resulting in an empty page (or empty part of a page depending on the state).

When I encounter such a problem, I disable all resolves (by commenting them out) in the state hierarchy and re-enable them one by one to see which one causes the problem and then add some logging inside the resolve callback to see what's happening.

Ui-router is awesome but it is still under development and this is one area where more debugging info would indeed be welcome.

Hope that helps!

jvandemo
  • 13,046
  • 2
  • 23
  • 18