我已经制作了一个Angular.js应用,并使用Grunt
搭建了yeoman
版本。该应用程序在开发中运行良好,但是当我构建并部署到登台服务器时,我在所有指令(自己和第三方)上都会出错:示例
Error: Multiple directives [tagManager, tagManager] asking for isolated scope on: <tag-manager tags="profile.styles" class="ng-isolate-scope ng-scope">
和
Error: Multiple directives [gender, gender] asking for template on: <gender value="profile.gender">
我认为指令很好,因为它们在开发中工作,但是(yeoman)构建中发生了什么?
此处参考是一个指令(在咖啡脚本中)
angular.module('clientApp')
.directive 'gender', [->
template: '<span><i class="{{icon}} {{color}}"></i></span>'
restrict: 'EA'
scope:
value: '=',
link: (scope, element, attrs) ->
if scope.value is 'male'
scope.icon = 'icon-male'
scope.color = 'blue_fg'
else
scope.icon = 'icon-female'
scope.color = 'pink_fg'
]