我一直在学习名为“使用Angular,节点和令牌身份验证创建应用程序”的多元视野课程,并且正在编写自己的自定义警报消息。
基本上,我想做的是根据警报消息的状态添加不同的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仓库。相关文件是根文件夹中的index.html,app / scripts / controllers下的register.js和app / scripts / services下的alert.js。
谢谢您的帮助。
更改此:
'alert-hidden:!alert.hasBeenShown'
对此:
'alert-hidden':!alert.hasBeenShown
您错过了属性名称中的右引号。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句