While posting a form angular.identity is used.What is the purpose of this and withCredential is also used.
Please explain??
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
MayankPosted Nov 17, 2016, 9:42 AM
angular.identity function is return the value passed in as a argument.
In the below example:$scope.square = function (n) {
return n * n
};
function transformer(transformationFn, value) {
return (transformationFn || angular.identity)(value);
};
$scope.initVal = 5;
1. $scope.squareResult = transformer($scope.square, $scope.initVal); //25
2. $scope.squareResult = transformer(null, $scope.initVal); //5
In first statement it will return 25 from square function when we pass $scope.square in transformer as first parameter.
When u call the transformer function as null in first parameter then it return 5 from angular.identity(5)
If u think it resolve your query then mask as answer.
Vinay SinghPosted Aug 16, 2016, 12:53 PM