AngularJS指令在不同的环境中发生冲突

时间:2017-04-18 10:57:16

标签: angularjs angularjs-directive

大家好,所以我的指令有问题

控制台出错:

  

错误:[$ compile:multidir]   http://errors.angularjs.org/1.5.0/ $编译/ multidir P0 = attendeesGroup&安培; P1 =&安培,P ... 3A%3AeventCode%22%20attendees%3D%22attendees%22%20search%3D%22search%22%3E       在app?v = i8y6GpTaEb1RAE-DuP0yglQXfZKxm4UD1Y48hiIfGJg1:1       at bt(app?v = i8y6GpTaEb1RAE-DuP0yglQXfZKxm4UD1Y48hiIfGJg1:1)       在ai(app?v = i8y6GpTaEb1RAE-DuP0yglQXfZKxm4UD1Y48hiIfGJg1:1)       在app?v = i8y6GpTaEb1RAE-DuP0yglQXfZKxm4UD1Y48hiIfGJg1:1       在app?v = i8y6GpTaEb1RAE-DuP0yglQXfZKxm4UD1Y48hiIfGJg1:1       at p。$ eval(app?v = i8y6GpTaEb1RAE-DuP0yglQXfZKxm4UD1Y48hiIfGJg1:1)       在p。$ digest(app?v = i8y6GpTaEb1RAE-DuP0yglQXfZKxm4UD1Y48hiIfGJg1:1)       at p。$ apply(app?v = i8y6GpTaEb1RAE-DuP0yglQXfZKxm4UD1Y48hiIfGJg1:1)       at ft(app?v = i8y6GpTaEb1RAE-DuP0yglQXfZKxm4UD1Y48hiIfGJg1:1)       at tt(app?v = i8y6GpTaEb1RAE-DuP0yglQXfZKxm4UD1Y48hiIfGJg1:1)

角度网站的错误

Multiple directives [attendeesGroup, attendeesGroup] asking for template on: <attendees-group event="::eventCode" attendees="attendees" search="search">

完整说明here 问题是它在我的本地主机上工作正常,它在第二(测试)环境下工作正常,但它在3号(预产品)上不起作用

这是HTML

    <div ng-hide="groups">
        <attendees-group event="::eventCode" attendees="attendees" search="search" />
    </div>

    <div ng-show="groups">
        <div ng-repeat="group in groups">
            <div ng-show="$parent.attendeesNumber[$index] = (group.Attendees | filter:search).length">
                <h6 class="med-heading">
                    <span ng-bind="::group.Value || 'Other'"></span>
                    <span style="font-size: 75%; margin-left: 5px; cursor: pointer;"
                          ng-if="canManage && group.Value"
                          class="fa fa-paint-brush"
                          ng-click="::changeColor(group.Value)"></span>
                </h6>
                <attendees-group event="::eventCode" attendees="group.Attendees" search="search" />
            </div>
        </div>
        <div ng-show="checkAttendeesNumber()">
            <h6 class="med-heading">
                <small>No attendees found. </small>
            </h6>
        </div>
    </div>

这是指令

angular.module('Events').directive('attendeesGroup', [
    function () {
        return {
            restrict: 'E',
            scope: { event: '=', attendees: '=', search: '=' },
            templateUrl: '/Content/AngularApp/Attendees/Components/AttendeesGroup/Template.html',
            link: function ($scope, $element, $attrs) { }
        };
    }
]);

有什么想法,建议吗?谢谢

2 个答案:

答案 0 :(得分:0)

您似乎在角度代码中多次声明了与会者组。

答案 1 :(得分:0)

好的,所以我发现了这个问题,这个答案可能会有所帮助,也可能没有帮助,具体取决于服务器和部署过程的配置方式,但提供了建议和可能的问题原因。

因此,我们使用jenkins在集成环境和Octopus上进行部署,以便将软件包从集成转移到下一个软件包。问题是由于某种原因(也许这是章鱼如何工作或者可能是以这种方式配置,不知道)何时从集成到下一个环境进行部署,在我的情况下进行测试,保留以前部署的文件当捆绑完成时,它包括先前版本和新版本(* .js),这导致捆绑具有重复指令。我通过从测试环境中删除以前的版本文件来解决问题。