how to send formdata with other field in angular4 #924

Open
opened 2017-11-13 07:46:13 +00:00 by roycemernaff · 5 comments
roycemernaff commented 2017-11-13 07:46:13 +00:00 (Migrated from github.com)

how to send formdata with other form field in angular4 using single variable

how to send formdata with other form field in angular4 using single variable
stas-kh commented 2017-11-15 13:43:41 +00:00 (Migrated from github.com)

If I understand you correctly, try this:

public uploader: FileUploader = new FileUploader({
    url: URL,
    additionalParameter: {
        otherField: 'value'
    }
});
If I understand you correctly, try this: ``` public uploader: FileUploader = new FileUploader({ url: URL, additionalParameter: { otherField: 'value' } }); ```
roycemernaff commented 2017-11-21 12:17:47 +00:00 (Migrated from github.com)

thank stas-kh

thank stas-kh
roycemernaff commented 2017-11-21 12:19:24 +00:00 (Migrated from github.com)

How do I print the below JSON using ngFor?
[
{
"projectID":"1",
"projectname":"project testing",
"projectdescription":"

project description proketc description</p>",

"projectimage":"[{"projectimage":"1511182675-0-three13.png"},
{"projectimage":"1511182675-1-two2.png"}]"
},
{
"projectID":"2",
"projectname":"roject settingp",
"projectdescription":"

roject setting

",
"projectimage":"[{"projectimage":"1511188378-0-three14.png"},
{"projectimage":"1511188378-1-two3.png"}]"

}]

I am using angular4 . i want to show above json using ngFor. I used first ngFor *ngFor="let project of projectdata" I tried second ngFor like *ngFor="let projectim of project.projectimage" *ngFor="let projectim of project['projectimage']"

Above is my code I try to print using ngFor. The first ngFor working properly. But the second ngFor shows below error:

Cannot find a differ supporting object
'[{"projectimage":"1511188378-0-three14.png"},{"projectimage":"1511188378-1-two3.png"}]'
of type 'string'.
NgFor only supports binding to Iterables such as Arrays.

How do I print the below JSON using ngFor? [ { "projectID":"1", "projectname":"project testing", "projectdescription":"<p>project description proketc description<\/p>", "projectimage":"[{\"projectimage\":\"1511182675-0-three13.png\"}, {\"projectimage\":\"1511182675-1-two2.png\"}]" }, { "projectID":"2", "projectname":"roject settingp", "projectdescription":"<p>roject setting</p>", "projectimage":"[{\"projectimage\":\"1511188378-0-three14.png\"}, {\"projectimage\":\"1511188378-1-two3.png\"}]" }] I am using angular4 . i want to show above json using ngFor. I used first ngFor *ngFor="let project of projectdata" I tried second ngFor like *ngFor="let projectim of project.projectimage" *ngFor="let projectim of project['projectimage']" Above is my code I try to print using ngFor. The first ngFor working properly. But the second ngFor shows below error: Cannot find a differ supporting object '[{"projectimage":"1511188378-0-three14.png"},{"projectimage":"1511188378-1-two3.png"}]' of type 'string'. NgFor only supports binding to Iterables such as Arrays.
Om1938 commented 2017-11-30 03:20:44 +00:00 (Migrated from github.com)

I want to send username with file and include the same in filename.
How to use the passed data there.

I want to send username with file and include the same in filename. How to use the passed data there.
aryaag commented 2018-09-27 03:01:20 +00:00 (Migrated from github.com)

@roycemernaff:
If the parameter to be sent is constant for a session, then you can set it when you initialize your FileUploader like below:

this.uploader = new FileUploader({
  url: 'http://localhost:3000/api/fileupload',
  additionalParameter: { key: 'some value here' }
});

If you want to send dynamic data, then you can use the setOptions method on the FileUploader. Like below:

let optns = this.uploader.options;
optns = {
  ...optns,
  additionalParameter: { paramName: this.dynamicParameter }
};
this.uploader.setOptions(optns);
@roycemernaff: If the parameter to be sent is constant for a session, then you can set it when you initialize your FileUploader like below: ```typescript this.uploader = new FileUploader({ url: 'http://localhost:3000/api/fileupload', additionalParameter: { key: 'some value here' } }); ``` If you want to send dynamic data, then you can use the `setOptions` method on the FileUploader. Like below: ```typescript let optns = this.uploader.options; optns = { ...optns, additionalParameter: { paramName: this.dynamicParameter } }; this.uploader.setOptions(optns); ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: dc/ng2-file-upload#924