2016-02-27 66 views
1

我一直在使用一個名爲Creating Apps with Angular,Node和Token Authentication的複合課程,並且正在編寫自己的自定義警報消息。

基本上,我想要做的是根據警報消息的狀態添加不同的CSS類。

當我打開我的應用程序,我在控制檯中出現以下錯誤:

Error: [$parse:syntax] Syntax Error: Token '}' is unexpected, expecting [:] at column 83 of the expression [{'flipInY': alert.show, 'flipOutY':!alert.show, 'alert-hidden:!alert.hasBeenShown'}] starting at [}] 

我不明白,因爲我敢肯定,我的語法是正確的。任何人都可以指出我做錯了什麼?

我的HTML:

<div class="container" ng-cloak> 
    <div ui-view></div> 
    <div class="alert alert-{{alert.type}} animated main-alert" ng-class="{'flipInY': alert.show, 'flipOutY':!alert.show, 'alert-hidden:!alert.hasBeenShown'}"><strong>{{ alert.title }}</strong> 
     {{ alert.message }} 
    </div> 
    </div> 

如果您需要更多的細節,請詢問或檢查Github repo。相關文件是根文件夾中的index.html,app/scripts/controllers下的register.js和app/scripts/services下的alert.js。

感謝您的幫助。

回答

3

更改此:

'alert-hidden:!alert.hasBeenShown' 

這樣:

'alert-hidden':!alert.hasBeenShown 

你錯過了在屬性名的封閉單引號。

+0

非常感謝,修正了它:) –