我对角度js全新,并尝试在ng-if为真时调用函数 我的代码=>
ng-repeat="image in post.postImages" ng-if="$index <= 3" ng-init="image.showDeleteIcon= false && hellow()"
和我的js =&gt;
<script type="text/javascript">
$scope.hellow = function ()
{
alert('hi');
};
</script>
也试试=&gt;
<span ng-if="$index === 3" ng-init="hellow()"></span>
问题是它没有提醒任何事情吗?有谁能告诉我我做错了什么?
答案 0 :(得分:0)
应该是这样的,
ng-repeat="image in post.postImages" ng-if="$index <= 3" ng-init="image.showDeleteIcon= false; hellow()";
答案 1 :(得分:0)