如何在我的指令标记中修复此End of Expression错误?

时间:2015-06-30 20:20:33

标签: javascript angularjs angularjs-directive

  

错误:$ parse:ueoe   意外结束表达

看看Chrome,这就是我在控制台中看到的内容: <div ng-class="{" green-up":="" tgh.tag.direction="=" "positive",="" "red-down":="" "negative",="" ""="" :="" "stagnant"}"="">

enter image description here

以下是the Gist的链接,以便于阅读。

template : 
    '<div class="tags-hover-container" ng-show="tgh.tag.tagsHoverDisplay"> ' +
        '<div class="tag-info-padding"> ' +
            '<div class="tweets-direction" ng-hide="!tgh.tag.quantity"> ' +
                '<div ng-hide="tgh.tag.length"> ' +
                    '<div ng-class="{"green-up": tgh.tag.direction == "positive", ' +
                                    '"red-down": tgh.tag.direction == "negative", ' +
                                    '""        : tgh.tag.direction == "stagnant"}"> ' +
                    '</div> ' +
                    '<div class="tweet-percentage">{{tgh.tag.tweet_percentage}}%</div> ' +
                '</div> ' +
                '<div class="tweet-count">{{tgh.tag.quantity}} tweets</div> ' +
            '</div> ' +
            '<div class="tweets-direction" ng-show="!tgh.tag.quantity">0 tweets</div> ' +
            '<div class="associated-tags"> ' +
                '<ul> ' +
                    '<li ng-repeat="ticker in tgh.tag.tickers"> ' +
                        '<div class="ticker" ng-click="tgh.selectTicker(ticker)">{{ticker}}</div> ' +
                    '</li> ' +
                '</ul> ' +
            '</div> ' +
        '</div> ' +
        '<div class="trending-tags-container"> ' +
            '<div class="trending-tags" title="trending tags"> ' +
                '<ul><li ng-repeat="trend in tgh.tag.momentum_twitter_preview">{{trend}}</li></ul> ' +
            '</div> ' +
        '</div> ' +
        '<div class="tag-actions"> ' +
            '<div class="tag-action-padding"> ' +
                '<div class="hide-tag" title="Coming soon"> ' +
                    '<div class="close-x-sml"></div>Hide Tag ' +
                '</div> ' +
                '<div class="add-my-watchlist" ' +
                     'ng-hide="tgh.tag.favorite == 1 || faved" ' +
                     'ng-click="tgh.addFavorite(tag)" title="Add to Favorites"> ' +
                     '+ My Favorites ' +
                '</div> ' +
                '<div class="add-my-watchlist" ' +
                     'ng-show="tgh.tag.favorite == 1 || faved" ' +
                     'ng-click="tgh.removeFavorite(tag)" title="Remove from Favorites"> ' +
                     '- My Favorites ' +
                '</div> ' +
            '</div> ' +
        '</div> ' +
        '<div class="tags-hover-bg"></div> ' +
    '</div>',
restrict: "E",

1 个答案:

答案 0 :(得分:1)

您的标记无效:

<div ng-class="{"green-up": tgh.tag.direction == "positive", ' + ...

您应该使用\转义双引号内的双引号或使用单引号。