2016-02-27 45 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

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