Reputation: 33
I have written the below code in html but getting an error of "The page you are looking for cannot be displayed because an invalid method (HTTP verb) is being used."
in my html:
<form name="payment" action="{{vm.resource.authEndpoint+ '/Payment/SecondOpinionCasePayment'}}" method="post">
in html page source:
<form name="payment" action="" method="post" class="ng-pristine ng-invalid ng-invalid-required">
I do not understated that Why action is going black. what is alternate for form post?
Getting below angular error.
Error: [$interpolate:interr] http://errors.angularjs.org/1.3.14/$interpolate/interr?p0=%7B%7Bvm.resource…%252Fapi*****.azurewebsites.net%252FPayment%252FSecondOpinionCasePayment at Error (native) at http://*****.azurewebsites.net/lib.min.js:11:417 at K (http://*****.azurewebsites.net/lib.min.js:93:52) at http://*****.azurewebsites.net/lib.min.js:114:238 at Object. (http://*****.azurewebsites.net/lib.min.js:112:433) at l.$digest (http://*****.azurewebsites.net/lib.min.js:128:3) at l.$apply (http://*****.azurewebsites.net/lib.min.js:131:58) at l (http://*****.azurewebsites.net/lib.min.js:86:171) at S (http://*****.azurewebsites.net/lib.min.js:90:301) at XMLHttpRequest.D.onload (http://*****.azurewebsites.net/lib.min.js:91:315)
Upvotes: 3
Views: 1653
Reputation: 3360
Form the URL in you controller wrapping it with $sce.trustAsResourceUrl()
use $sce
to sanitize elements from potentially insecure content, if you trust the URL you can use $sce
.
Inject 'ngSanitize'
in your app,
var app = angular.module('myApp', ['ngSanitize']);
then controller would be,
app.controller('urlController',['$scope', '$sce', function($scope, $sce){
var actionURL = vm.resource.authEndpoint+"/Payment/SecondOpinionCasePayment";
$scope.formAction = $sce.trustAsResourceUrl(actionURL);
}]);
then in your html form,
<form name="payment" action="{{formAction}}" method="post">
Upvotes: 5
Reputation: 4401
What you probably have in the scope is the model for the base url. modify it as:
<form name="payment" action="{{vm.resource.authEndpoint}}/Payment/SecondOpinionCasePayment" method="post">
Upvotes: 0