2017-04-16 39 views
1

我有一個非常奇怪的問題。我正在使用$ interpolateProvider在我的Angular應用程序,因爲我通過一些變量與節點是「{{}}」默認情況下,所以我已經設置了Angular的符號爲:「{[]}」

見下文:現在

mainApp.config(function($interpolateProvider) { 
    $interpolateProvider.startSymbol('{['); 
    $interpolateProvider.endSymbol(']}'); 
}); 

,該作品無處不在,除了在我的應用程序的一個組成部分。請參見下面的HTML:

<ul class="nav navbar-nav navbar-right" ng-controller="navBarController"> 

<li><a href="/profile#/profile">Profile</a></li> 
<li> 
<notification-icon count="{[notificationsCount]}"><i class="fa fa-envelope-o fa-2x"></i></notification-icon> 
</li> 
<li class="dropdown"> 
<a class="dropdown-toggle" data-toggle="dropdown">Settings<strong class="caret"></strong></a> 
<ul class="dropdown-menu"> 
    <li> 
     <a href="/profileSettings#">Profile Settings</a> 
    </li> 
    <li class="divider"></li> 
    <li> 
     <a href="/logout">Logout</a> 
    </li> 
</ul> 
</li> 
{[notificationsCount]} 
</ul> 

不起作用位是:

count="{[notificationsCount]}" 

,做工作的比特是正確的結尾:

{[notificationsCount]} 

在瀏覽器中,我收到來自Angular的this錯誤,並且當我檢查元素時,它以純文本形式顯示,如:{[notificationsCount]}並且不會轉換爲所需的數字HTML代碼的第二行。

我懷疑這可能是由於我使用的第三方模塊,這是angular-notification-icons,但我不能確定。

我不知道如何繼續這個。任何輸入都會有幫助。

非常感謝!

回答

1

,需要在不{[]}的地方寫在代碼不仔細的例子從https://github.com/jacob-meacham/angular-notification-icons工作

<notification-icon count="notificationsCount"><i class="fa fa-envelope-o fa-2x"></i></notification-icon> 

看,notificationsCount直接使用諸如指令屬性。

+0

你是男人!工作。現在要繼續撞牆,因爲它偶爾缺乏處理能力。非常感謝! –

相關問題