角度抛出错误$ parse:ueoe意外结束表达式

时间:2015-08-19 00:16:30

标签: javascript regex angularjs node.js

我网站的这一部分出现了错误,我无法弄清楚,因为我几个月内都没有改变。

错误是:

Error: [$parse:ueoe] http://errors.angularjs.org/1.4.3/$parse/ueoe?p0=event._id%3FEventController
    at Error (native)
    at http://localhost:3000/scripts/libs.js:44598:416
    at Object.q.consume (http://localhost:3000/scripts/libs.js:44801:157)
    at Object.q.ternary (http://localhost:3000/scripts/libs.js:44794:497)
    at Object.q.assignment (http://localhost:3000/scripts/libs.js:44794:284)
    at Object.q.expression (http://localhost:3000/scripts/libs.js:44794:237)
    at Object.q.filterChain (http://localhost:3000/scripts/libs.js:44794:145)
    at Object.q.expressionStatement (http://localhost:3000/scripts/libs.js:44794:91)
    at Object.q.program (http://localhost:3000/scripts/libs.js:44793:458)
    at Object.q.ast (http://localhost:3000/scripts/libs.js:44793:257) <li class="controller__item controller__item--disabled" data-controller-range="[1, 1]" data-event-sidebar-to="false" ng-click="event._id ? EventController.update(event._id, event) : EventController.create(event)">

根据angular.js:

错误:$ parse:ueoe 意外的表达结束 意外的表达结束:event._id 描述 表达式在表达式末尾缺少标记时发生。例如,忘记表达式中的右括号将触发此错误。

要解决此问题,请详细了解Angular表达式,识别错误并修复表达式的语法。

HTML模板:

<main class="main">
    <div ng-include src="'/admin/navbar/navbar.template.html'"></div>
    <div ng-include src="'/admin/breadcrumb/breadcrumb.template.html'"></div>
    <section class="events">
        <div class="events__container">
            <div class="events__row">
                <div class="col-md-12">
                    <div class="events__box">
                        <div class="events__header">
                            <h2 class="events__title"> Todos os eventos - </h2>
                        </div>
                        <div class="events__body">
                            <table class="events__table" data-table>
                                <!-- directive:table-sorter-directive -->
                                <thead>
                                    <tr>
                                        <th class="events__th events__th--all">
                                            <input type="checkbox" />
                                        </th>
                                        <th class="events__th"> Nome </th>
                                        <th class="events__th"> Data </th>
                                        <th class="events__th events__th--reservations"> Reservas </th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <tr class="events__tr" ng-repeat="event in events">
                                        <td class="events__td events__td--checkbox">
                                            <input type="checkbox" data-controller-input ng-click="EventController.retrieveOne(event._id)"/>
                                        </td>
                                        <td class="events__td"> {{ event.name }} </td>
                                        <td class="events__td"> {{ event.date }} </td>
                                        <td class="events__td events__td--reservations"> 50 </td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
            <aside class="events__sidebar" data-event-sidebar>
                <!-- directive:event-sidebar-directive  -->
                <form class="events__sidebar-form" method="POST" action="#">
                    <div class="events__sidebar-group">
                        <label class="events__sidebar-label" for="event_value"> Valores: </label>
                        <input class="events__sidebar-input event__sidebar-input--value" type="text" id="event_value" ng-model="event.men"/>
                        <input class="events__sidebar-input event__sidebar-input--value" type="text" id="event_value" ng-model="event.women"/>
                    </div>
                    <div class="events__sidebar-group">
                        <label class="events__sidebar-label" for="event_name"> Nome do evento: </label>
                        <input class="events__sidebar-input" type="text" id="event_name" ng-model="event.name"/>
                    </div>
                    <div class="events__sidebar-group">
                        <label class="events__sidebar-label" for="event_hour"> Hora: </label>
                        <input class="events__sidebar-input" type="text" id="event_hour" ng-model="event.hour"/>
                    </div>
                    <div class="events__sidebar-group">
                        <label class="events__sidebar-label" for="event_point"> Ponto de encontro: </label>
                        <input class="events__sidebar-input" type="text" id="event_point" ng-model="event.meeting"/>
                    </div>
                    <div class="events__sidebar-group">
                        <label class="events__sidebar-label" for="event_info"> Informações simples: </label>
                        <input class="events__sidebar-input" type="text" id="event_info" placeholder="1 Hora de Open Bar + 2 horas de loucura"/>
                    </div>
                    <div class="events__sidebar-group">
                        <label class="events__sidebar-label" for="event_hiw"> Como funciona: </label>
                        <input class="events__sidebar-input" type="text" id="event_hiw" ng-model="event.hiw"/>
                    </div>
                </form>
            </aside>
        </div>
    </section>
    <aside class="controller" data-controller> 
        <!-- directive:controller-directive -->
        <!-- directive:controller-action-directive  -->
        <div class="controller__controller" data-controller-indicator>
            <i class="icon icon__cogs"></i>
        </div>
        <div class="controller__container">
            <ul class="controller__list">
                <li class="controller__item"                            data-controller-range="[0]" data-event-sidebar-to="true" ng-click="EventController.clean()">
                    <i    class="icon icon__plus icon__2x"></i>
                    <span class="controller__legend"> Novo </span>
                </li>
                <li class="controller__item controller__item--disabled" data-controller-range="[1, 1]" data-event-sidebar-to="true">
                    <i    class="icon icon__pencil icon__2x"></i>
                    <span class="controller__legend"> Editar </span>
                </li>
                <li class="controller__item controller__item--disabled" data-controller-range="[1, 1]" data-event-sidebar-to="false" ng-click="event._id ? EventController.update(event._id, event) : EventController.create(event)">
                    <i    class="icon icon__cloud icon__2x"></i>
                    <span class="controller__legend"> Salvar </span>
                </li>
                <li class="controller__item controller__item--disabled" data-controller-range="[1]" data-event-sidebar-to="false" ng-click="EventController.delete(event._id)">
                    <i    class="icon icon__trash icon__2x"></i>
                    <span class="controller__legend"> Deletar </span>
                </li>
                <li class="controller__item controller__item--email">
                    <i    class="icon icon__search icon__2x"></i>
                    <span class="controller__legend"> E-mail </span>
                </li>
                <li class="controller__item controller__item--search">
                    <i    class="icon icon__envelope icon__2x"></i>
                    <span class="controller__legend"> Pesquisar </span>
                </li>
            </ul>
        </div>
    </aside>
</main>

EventController.js:

'use strict';
var EventController = function(scope, EventModel) {
    this.scope      = scope;
    this.EventModel = EventModel;
    this.scope.store = [];

    this.retrieve();
};

EventController.prototype = {
    clean: function() {
        this.scope.event = {};
    },

    create: function(newEvent) {
        this.EventModel.Model.insert(newEvent)
            .then(function(result) {

            });
    },

    retrieve: function() {
        var that = this;

        this.EventModel.Model.find()
            .then(function(result) {
                that.scope.events = result;
            });
    },

    retrieveOne: function(eventId) {
        var that = this;

        this.EventModel.Model.findOne(eventId)
            .then(function(result) {
                that.scope.event = result;
            });
    },

    update: function(editedEvent, event) {
        this.EventModel.Model.update(editedEvent, event)
            .then(function(result) {

            });
    },

    delete: function(eventId) {
        this.EventModel.Model.remove(eventId)
            .then(function(result) {

            });
    }
};

angular.module('adminApp').controller('EventController', ['$scope', 'EventModel', EventController]);

我无法弄清问题是什么。有人可以帮忙吗?

感谢。

2 个答案:

答案 0 :(得分:2)

我认为错误可能是src属性

的原因
ng-include src="'/admin/navbar/navbar.template.html'"
ng-include src="'/admin/breadcrumb/breadcrumb.template.html'"

应该是

ng-include="'/admin/navbar/navbar.template.html'"
ng-include="'/admin/breadcrumb/breadcrumb.template.html'" 
仅当src element

包含时,

<ng-include才应该是属性

但在您的情况下,ng-include用作attribute

有关详细信息,请查看文档 ng-include

答案 1 :(得分:-1)

在ng-grid.js中隐藏此代码 - 在添加组时添加额外的列。

由于最初没有数据,但是有初始分组,因此不会添加列

    if(cols.length > 0) {
        for (var z = 0; z < groups.length; z++) {
            if (!cols[z].isAggCol && z <= maxDepth) {
                cols.push(new ngColumn({
                    colDef: {
                        field: '',
                        width: 25,
                        sortable: false,
                        resizable: false,
                        headerCellTemplate: '<div class="ngAggHeader"></div>',
                        pinned: grid.config.pinSelectionCheckbox

                    },
                    enablePinning: grid.config.enablePinning,
                    isAggCol: true,
                    headerRowHeight: grid.config.headerRowHeight

                }, $scope, grid, domUtilityService, $templateCache, $utils));
            }
        }
    }