0

Hello I have made app using angular, I have used ui-router for routing, I have minified the whole angular app using gulp-uglify.

After minifying app, my child route(nested route) of ui-router is not rendering view, main parent routes are working properly.

Can some one suggest me what to do here is my route sample:

.state('masterPage', {
  url: "",
  abstract: true,
  templateUrl: 'src/app/Client/common/fullPage.html'
}).state('masterPage.userProfile.dashboard', {
  url: "/dashboard",
  templateUrl: "src/app/Client/userProfile/dashboard/index.html",
  controller: "userDashboard",
  controllerAs: 'vm'
})
3
  • 1
    Did you check the console for errors? Commented Sep 18, 2017 at 15:26
  • Please show the definition of the controller userDashboard. This usually happens because of injected dependencies getting mangled in the min process. Look at the warning under implicit annotation here: docs.angularjs.org/guide/di Commented Sep 18, 2017 at 15:55
  • there is no errors in console Commented Sep 18, 2017 at 15:59

1 Answer 1

1

When you minify the the app, It breaks the dependency injection. After minifying $scope is no longer $scope, they are minified variable like e or a. Which doesn't makes any sense for angularJS. To resolve this you can use ng-annotate for gulp and grunt and comment functions that need automated dependency injection using /* @ngInject */

Go through this link for more details about it. AngularJs Minification and Annotation

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

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.