我在angularjs中使用了一个ng-switch来根据url在我的页面中拥有动态内容。我正在和约曼一起管理我的项目。下面是动态内容生成的代码:
html:
<div class="div-content bgcontent" id="content">
<span ng-switch on="renderPath[0]">
<div ng-switch-when="home" ng-include="'partials/home.html'"></div>
<div ng-switch-when="gallery" ng-include="'partials/gallery.html'"></div>
</span>
</div>控制器:
$scope.renderPath = $location.path().split('/');
// remove first entry because it's empty string
$scope.renderPath.shift();当使用'yeoman server‘运行这些东西时,这个功能运行得非常好。但是如果我使用'yeoman build:minify‘进行构建,之后它就不能工作了。它命中了一个断言:
at assertArg (http://host:8888/scripts/vendor/d10639ae.angular.js:973:11)
at Object.ngDirective.compile (http://host:8888/scripts/vendor/d10639ae.angular.js:13474:5)
at applyDirectivesToNode (http://host:8888/scripts/vendor/d10639ae.angular.js:4047:32)
at compileNodes (http://host:8888/scripts/vendor/d10639ae.angular.js:3794:14)
at compileNodes (http://host:8888/scripts/vendor/d10639ae.angular.js:3799:14)
at compile (http://host:8888/scripts/vendor/d10639ae.angular.js:3739:29)
at update (http://host:8888/scripts/vendor/d10639ae.angular.js:13685:22)
at $get.Scope.$broadcast.next (http://host:8888/scripts/vendor/d10639ae.angular.js:8002:24)
at Array.forEach (native)
at forEach (http://host:8888/scripts/vendor/d10639ae.angular.js:110:11) <!-- ngSwitchWhen: home -->有人知道怎么解决这个问题吗?或者我需要在哪里调试它?
发布于 2013-02-27 21:26:23
如果在脚本中使用依赖项注入,请确保使用下面所述的最小化验证语法:http://docs.angularjs.org/guide/di
https://stackoverflow.com/questions/14230248
复制相似问题