Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/473.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何修复my指令标记中的表达式结束错误?_Javascript_Angularjs_Angularjs Directive - Fatal编程技术网

Javascript 如何修复my指令标记中的表达式结束错误?

Javascript 如何修复my指令标记中的表达式结束错误?,javascript,angularjs,angularjs-directive,Javascript,Angularjs,Angularjs Directive,错误:$parse:ueoe 意外的表达结束 看看Chrome,这是我在控制台中看到的: 这里有一个链接,以便于阅读 template : '<div class="tags-hover-container" ng-show="tgh.tag.tagsHoverDisplay"> ' + '<div class="tag-info-padding"> ' + '<div class="tweets-directi

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

看看Chrome,这是我在控制台中看到的:

这里有一个链接,以便于阅读

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",
模板:
' ' +
' ' +
' ' +
' ' +
' ' +
' ' +
“{{tgh.tag.tweet_percentage}}%”+
' ' +
“{tgh.tag.quantity}}推特”+
' ' +
“0条推特”+
' ' +
“
    ”+ “
  • ”+ “{{ticker}}”+ “
  • ”+ “
”+ ' ' + ' ' + ' ' + ' ' + “
  • {{trend}
”+ ' ' + ' ' + ' ' + ' ' + ' ' + “隐藏标签”+ ' ' + ' ' + “+我的最爱”+ ' ' + ' ' + “-我的最爱”+ ' ' + ' ' + ' ' + ' ' + '', 限制:“E”,
此处的标记无效:

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

好的,在上面的上下文中,我该如何解决这个问题?我必须使用单引号,因为我打断了行,所以模板标记很容易查看<代码>'+'
是的,您可以进行编码以生成有效的标记。您使用
模板
而不是
模板URL
的任何原因?单独的html确实有助于提高可读性。是的,我最初在外部使用它,但它的运行速度似乎快了一点。。。以毫秒计。不仅如此,我还在努力减少请求。因此,现在使用dev脚本,我下载了80多个文件,我所有的Angular模块连接在一起,它会下降到50多个,如果我将所有模板HTML文件移动到指令中,我会再删除20多个!是的,有些权衡…你试过生产建设吗?我们有一个构建任务,通过
grunt-html2js
和concat将所有html编译成js模板,通过
grunt-contrib-concat
grunt-contrib-uglify
。我们正在使用Gulp,但不知道这是如何工作的。。。您是否也需要更改指令中的某些内容?指向js模板中的某些内容?我会检查一下Gulp有什么。。。