简体   繁体   中英

How can I consume Amazon S3 JavaScript APIs with AngularJS 2?

I am writing an Angular2 application. Can someone please tell me how I can consume S3 Javascript APIs from Angular2. Is it even possible?

Or is there a procedure through which I can use the javascript APIs from my typescript? I am using SystemJS for module loading.

This might help.

http://www.spacevatican.org/2013/7/7/direct-to-s3-browser-uploads/

You need to generate a policy document signed by your access key to authorize the request. That would be done server-side for security reasons. There's nothing stopping you from using your access key directly except that then you'd be giving them full access to the whole bucket at minimum.

You can do that using the AWS Javascript SDK for the browser available here -> https://aws.amazon.com/sdk-for-browser/

This is the main documentation , its not be mistaken with the Node API which is also in Javascript.

According to the docs you can do calls to amazon s3 which is what you are looking for.

There is nothing special that you need to do in an Angular 2 program to make this work, Angular 2 is compatible out of the box with third part APIs.

If you run into issues like things not getting updated on the screen, you can wrap your call in an NgZone run call , but this in principle should not be necessary.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM