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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Vinay SinghRank #604 · 4K reputationPosted Aug 16, 2016, 8:53 AM EDT
MayankRank #4,018 · 371 reputationPosted Nov 17, 2016, 4:42 AM EST
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.