2

我制作了一个 Angular.js 应用程序并Grunt使用yeoman. 该应用程序在开发中运行良好,但是当我构建并部署到登台服务器时,所有指令(自己的和第 3 方)都会出错:示例

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'
  ]
4

0 回答 0