Angularjs 为什么我的ng秀不与<;img>;?
我无法使我的ng show显示基于函数返回的图像。如果为真、假或空,则应返回不同的图像 如果你不能解决我的问题,你能告诉我正确的方向吗 如果您能看看html代码中的语法,我将非常感激,它在chrome调试控制台中抛出了25个错误:Angularjs 为什么我的ng秀不与<;img>;?,angularjs,ng-show,angularjs-ng-show,Angularjs,Ng Show,Angularjs Ng Show,我无法使我的ng show显示基于函数返回的图像。如果为真、假或空,则应返回不同的图像 如果你不能解决我的问题,你能告诉我正确的方向吗 如果您能看看html代码中的语法,我将非常感激,它在chrome调试控制台中抛出了25个错误: Error: [$parse:syntax] http://errors.angularjs.org/1.6.4/$parse/syntax?p0=%7B&p1=invalid%20key&p2=…%3D%3D%20'true'&p4=%7Bi
Error: [$parse:syntax] http://errors.angularjs.org/1.6.4/$parse/syntax?p0=%7B&p1=invalid%20key&p2=…%3D%3D%20'true'&p4=%7BisAttending(student.id%2Clesson.id)%20%3D%3D%20'true'
at angular.js:38
at s.throwError (angular.js:15090)
at s.object (angular.js:15079)
at s.primary (angular.js:14968)
at s.unary (angular.js:14956)
at s.multiplicative (angular.js:14943)
at s.additive (angular.js:14934)
at s.relational (angular.js:14925)
at s.equality (angular.js:14916)
at s.logicalAND (angular.js:14908) "<div ng-show="{{isAttending(student.id,lesson.id) == 'true'">"
CSS:
你打字有误
<div ng-show="isAttending(student.id,lesson.id)">
这是导致角度日志中出现错误的原因,请参见最后一行
如果您希望img可见,则isAttending
函数应返回true
<div ng-show="isAttending(student.id,lesson.id)">
这是导致角度日志中出现错误的原因,请参见最后一行
如果希望img可见,则
isAttending
函数应返回true如果看到错误,最后一行显示错误。
当您使用像ng这样的角度标记时,表明您不必使用大括号{{
去掉大括号,它应该可以正常工作如果您看到错误,最后一行显示您的错误。 当您使用像ng这样的角度标记时,表明您不必使用大括号{{ 拆下卷曲的支架,它应该可以正常工作
body {
margin:0;
}
div#um{
background-color: white;
}
ul#dois {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
margin-top: 8px;
}
li a {
float: left;
display: block;
color: black;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
table, th, td{
border: 1px solid #ebebeb;
}
table{
border-collapse: collapse;
width: 100%;
}
th {
height: 50px;
}
img#imgUnchecked, #imgChecked{
padding-left: 10px; padding-top: 16px; padding-right: 11px;
}
<div ng-show="isAttending(student.id,lesson.id)">