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.

8
  • Are you using Chrome Dev Tools? Commented Jan 6, 2014 at 13:23
  • @coma yes, shows nothing Commented Jan 6, 2014 at 13:24
  • If there is no error in the Chrome console maybe you just disabled the javascript... Commented Jan 6, 2014 at 13:30
  • this view exists in the ui-view? like ui-view="inputView"? Commented Jan 6, 2014 at 13:46
  • @Deividi Cavarzan Yes. Commented Jan 6, 2014 at 13:48

2 Answers 2

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

Sign up to request clarification or add additional context in comments.

1 Comment

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?
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!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.