ng-bind:使用双冒号连接两个值

时间:2015-07-26 14:46:54

标签: angularjs ng-bind

当两个冒号用双冒号连接时,我们如何使用ng-bind

<title ng-bind="::AppConfig.SITE_TITLE + ::AppConfig.PAGE_TITLE"></title>

以上代码返回此错误:

Error: [$parse:syntax] Syntax Error: Token ':' not a primary expression at column 24 of the expression [AppConfig.SITE_TITLE + ::AppConfig.PAGE_TITLE] starting at [::AppConfig.PAGE_TITLE].

请注意,这样可以正常工作:

<title ng-bind="::AppConfig.SITE_TITLE + ' | This is page title'"></title>

2 个答案:

答案 0 :(得分:5)

尝试:<title ng-bind="::(AppConfig.SITE_TITLE + AppConfig.PAGE_TITLE)"></title>

答案 1 :(得分:0)

可以使用表达式而不是ng-bind

content
相关问题