Angular not evaluating expression in form action

In my Angular view, I am using an expression for a form action. Mysteriously, it is not evaluated and instead makes an HTTP request for http://127.0.0.1:8000/{{ apiUrl }}

instead of the one set by apiUrl.

apiUrl is set by the following code: $scope.apiUrl = config.APIURLBase + '/api/upload';

which looks like it works fine.

Any ideas?

<h1>Upload new File</h1>
<form action="{{ apiUrl }}" method="post" enctype="multipart/form-data" id="upload-form" class="dropzone" ng-dropzone dropzone="dropzone" dropzone-config="dropzoneConfig">
    <div class="dz-message">
        Drop files here or click to upload
    </div>
    <div class="fallback">
        <input type="file" name="files" multiple />
    </div>
</form>

      

+3


source to share


1 answer


I ran into something similar and made the following fix for me.

$scope.api = config.APIURLBase;

      



And in your form

<form action="{{ api + '/api/upload' }}" method="post" enctype="multipart/form-data" id="upload-form" class="dropzone" ng-dropzone dropzone="dropzone" dropzone-config="dropzoneConfig">

      

+3


source







All Articles