今天,我看到一个角色的bug:
原文链接:https://www.f2er.com/angularjs/142711.html当您尝试直接在ng点击中设置范围值时,当您的点击是ng – 如果哪个测试具有相同的范围值 – >时,它不起作用. http://jsfiddle.net/9j2TL/26/
angular.module('test',[]) .controller('testCtrl',function($scope) { $scope.step = 1; $scope.setStep = function(step) { $scope.step = step; }; }); <div ng-app="test"> <div ng-controller="testCtrl"> <ul class="timeline"> <li> <div class="block-submit"> <button class="btn btn-primary btn-lg" ng-click="step = 2">Without ngif block</button> </div> </li> <li ng-if="step > 1"> <div class="block-submit"> <button class="btn btn-primary btn-lg" ng-click="step = 3">with ngif block</button> </div> </li> <li ng-if="step > 1"> <div class="block-submit"> <button class="btn btn-primary btn-lg" ng-click="setStep(3)">With ngif block and scope function</button> </div> </li> </ul> <p> step value : {{ step }} </p> </div> </div>
如果有人解释这个问题,我很乐意理解它!
谢谢 :)