您好我使用angular制作应用程序,我使用ui-router进行路由,我使用gulp-uglify缩小了整个角度应用程序。
在缩小app之后,ui-router的子路由(嵌套路由)不是渲染视图,主要父路由正常工作。
有人建议我这里做的是我的路线样本:
.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'
})
答案 0 :(得分:1)
当你缩小应用程序时,它会打破依赖注入。在缩小$ scope不再是$ scope之后,它们是缩小变量,如e或a。这对angularJS没有任何意义。要解决此问题,您可以使用 / * @ * @InInject * /
对需要自动依赖注入的gulp和grunt以及注释函数使用 ng-annotate通过此链接了解有关它的更多详细信息。 AngularJs Minification and Annotation