I've try to convert my code from html to jade and using express render it on server side. here is my ng-repeat code snippet
ul.task-list
li.published-list(ng-repeat='tsk in app.dataTask')
div(ng-style='{"background-color":tsk.color}')
input(type='checkbox', ng-model='tsk.status', ng-click='app.taskComplete(tsk)')
span(ng-class='{"done":tsk.status}') {{tsk.contents}}
span.align.glyphicon.glyphicon-align-justify
the strange thing is all the tsk.status
, tsk.status
, tsk.contents
working fine and get value. but tsk.color
cannot, it's working fine previously in html format, may I know how to write a correct ng-style in Jade?
the error I got from debug is
Error: [$parse:syntax] http://errors.angularjs.org/1.3.1/$parse/syntax?p0=Object&p1=is[object Object]nexpected%C%expecting%%5B%D%D&p2=9&p3=%Bobject%Object%D&p4=Object%D ...
Codepen sample:
似乎使用backgroundColor
而不是background-color
解决Jade的问题:
div(ng-style='{"backgroundColor":tsk.color}')
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.