Use ng-show to control a pop-up box
Change the value of value in the click event of a button (using jQuery Ajax)
Through the console.log, I can see that the value of value has indeed become true, but when I click the button, the order exception box does not pop up. The second click will pop up
Why is it necessary? Execute twice to pop up?
Put $scope.value = true; outside Ajax to pop up the box at once.
Replacing $scope.valuer with $rootScope won’t work either.
Solution.
某草草2017-05-15 17:06:23
$scope.RealTimeUpdate = function (obj) {
var thisRurl = '/MFreeXFapi/student/RealTimeUpdate';
var rturl = $(obj).attr('rthref');
$http({
method: 'POST',
url: thisRurl,
transformRequest: $.param,
headers: { 'Content-Type': 'application/x-www-form-urlencoded;' },
data: 'ProductId=' + $rootScope.paycourseId + '&studentid=' + $scope.userData.rowId + '&orderid=' + $scope.payood,
}).success(function (data) {
if (data != true) {
$scope.orderError = true;
console.log($scope.orderError)
} else {
window.location.href = rturl
}
})
};
jq’s ajax will not trigger ng’s checking mechanism. You need to use $http instead or use $scope.$apply after changing the model
http://stackoverflow.com/ques...