Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
AngularJS表达式中的运算符增量_Angularjs - Fatal编程技术网

AngularJS表达式中的运算符增量

AngularJS表达式中的运算符增量,angularjs,Angularjs,我使用angularjs并在控制器中初始化变量,如下所示: $scope.x = 0; <div index = {{x++}}></div> <a index = {{x++}}></a> <b index = {{x++}}></b> <p index = {{x++}}></p> 我想在html中增加变量x,我编写表达式如下: $scope.x = 0; <div index = {

我使用angularjs并在控制器中初始化变量,如下所示:

$scope.x = 0;
<div index = {{x++}}></div>
<a index = {{x++}}></a>
<b index = {{x++}}></b>
<p index = {{x++}}></p>
我想在html中增加变量x,我编写表达式如下:

$scope.x = 0;
<div index = {{x++}}></div>
<a index = {{x++}}></a>
<b index = {{x++}}></b>
<p index = {{x++}}></p>

但成功不是吗 我该怎么办


不要使用ng click,ng repeat,…

如果像
那样编写会发生什么?谢谢,但我想自动递增x,而不仅仅是显示x+1为什么要这样做?这似乎。。。奇怪。这个链接可以帮助哦,在这种情况下,不要使用指令作为ng点击,ng重复。。。