문제

나는 Angularjs의 새로운 것입니다.

IT의 값을 기반으로 두 번째 열에 클래스를 추가하려고합니다. 예 : 값이> 0이고 '음수'가 <0.

일 때 클래스의 '양수'클래스를 추가하고 싶습니다.

현재 사용중인 것 :

<td data-ng-class="{positive: $index==1 && {{values}} > 0 , negative:{{values}} < 0 && $index==1 }" ng-repeat="values in portfolio" >{{values}}</td>
.

이제는 이렇게 작동하는 것 같습니다 (이미지 참조) :

여기에 이미지 설명을 입력하십시오

그러나 내 콘솔에서 다음을 받고 있습니다 :

오류 : [$ PARSE : 구문] http://errors.angularjs.org/1.2. 7 / $ PRSE / 구문? p0= % 26 & p1= is % 20unexpected % 2c % 20Expecting % 20 % 5b % 7d % 5d & p2= 26 & p3= % 7BPositive % 3A % 20 % 24Index % 3D % 3D1 % 20 % 26 % 26P500 % 20 % 26P500 % 200 % 200 % 200 % 20 % 2C % 26P500 % 20 % 3C % 200 % 20 % 26 % 26 % 20 % 24 인덱스 % 3D % 3D1 % 20 % 7D & P4= % 26P500 % 20 % 3E % 200 % 20 % 20 % 2C % 3AS % 3AS 26P500 % 20 % 3C % 200 % 20 % 26 % 26 % 20 % 24 인덱스 % 3D % 3D1 % 20 % 7D 오류 () https : //ajax.googleapis. .com / ajax / libs / angularjs / 1.2.7 / angular.min.js : 6 : 449 xa.throwerror ( https : / /ajax.googleapis.com/ajax/libs/angularjs/1.2.7/angular.min.js:155:346 ) xa.consume ( https : / /ajax.googleapis.com/ajax/libs/angularjs/1.2.7/angular.min.js:156:325 ) xa.object ( https : / /ajax.googleapis.com/ajax/libs/angularjs/1.2.7/angular.min.js : 164:115 ) xa.primary ( https : / /ajax.googleapis.com/ajax/libs/angularjs/1.2.7/angular.min.js:154:482 ) xa.unary ( https : / /ajax.googleapis.com/ajax/libs/angularjs/1.2.7/angular.min.js:161:240 ) xa.multiplicative ( https : / /ajax.googleapis.com/ajax/libs/angularjs/1.2.7/angular.min.js:160:480 ) xa.aditive ( https : / /ajax.googleapis.com/ajax/libs/angularjs/1.2.7/angular.min.js:160:325 ) xa.relational ( https : / /ajax.googleapis.com/ajax/libs/angularjs/1.2.7/angular.min.js:160:204 )

도움이 되었습니까?

해결책

시도 :

<td data-ng-class="{positive: $index==1 && values > 0, negative:values < 0 && $index==1 }" ng-repeat="values in portfolio" >{{values}}</td>
.

다른 팁

{{values}}values

로 변경해야합니다.
<td data-ng-class="{positive: $index==1 && values > 0 , negative:values < 0 && $index==1 }" ng-repeat="values in portfolio" >{{values}}</td>
.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top