ng-bind:用双冒号连接两个值
ng-bind: concatination of two values with double colons
当两个值用双冒号连接时,我们如何使用 ng-bind
?
<title ng-bind="::AppConfig.SITE_TITLE + ::AppConfig.PAGE_TITLE"></title>
上面的代码returns这个错误:
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>
尝试:<title ng-bind="::(AppConfig.SITE_TITLE + AppConfig.PAGE_TITLE)"></title>
可以使用表达式代替 ng-bind
<title>{{::AppConfig.SITE_TITLE}} | {{::AppConfig.PAGE_TITLE}}</title>
当两个值用双冒号连接时,我们如何使用 ng-bind
?
<title ng-bind="::AppConfig.SITE_TITLE + ::AppConfig.PAGE_TITLE"></title>
上面的代码returns这个错误:
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>
尝试:<title ng-bind="::(AppConfig.SITE_TITLE + AppConfig.PAGE_TITLE)"></title>
可以使用表达式代替 ng-bind
<title>{{::AppConfig.SITE_TITLE}} | {{::AppConfig.PAGE_TITLE}}</title>