4

i have a angular 2 application. I was wondering if i could convert this application to an integrate-able sdk which other applications can use by adding script tags in their headers. If this is not possible can anyone provide any tutorial link which shows how can i build a simple sdk which can be integrated in other applications. thank you.

Shoaib Iqbal
  • 2,420
  • 4
  • 26
  • 51
  • 1
    Are you asking about "Angular 7 create custom elements"?, see e.g. https://medium.freecodecamp.org/how-to-create-angular-6-custom-elements-web-components-c88814dc6e0a – Eliseo Jan 16 '19 at 10:40
  • thank you @Eliseo. this is exactly what i was looking far. – Shoaib Iqbal Jan 16 '19 at 11:17

1 Answers1

2

Of course you can! In javascript terms, it's not called "SDK" but "module". The most popular module manager is called NPM. So you can follow this tutorial to package your "application" as NPM module, then it will be easy for other js developper to integrate it inside their own projects (using the tags, services, directives you defined.

Here is a good post about it

Cheers!

EDIT : if you want to use your angular components/modules outside in non-angular application, you can follow this one. In the example it is used with React app but it will work with any html5-compliant browsers.

If you want to target also non-compatible browsers, you should add a polyfill

Benjamin Caure
  • 2,090
  • 20
  • 27
  • 1
    thank you Benjamin Caure for your answer but i don't want NPM package/module instead i want to package my application in form of bundle such as .min.js files which users can download and add it in their websites/applications. – Shoaib Iqbal Jan 16 '19 at 09:38
  • ok, so any type of js files can be integrated using – Benjamin Caure Jan 16 '19 at 09:48
  • 1
    i just want to convert my angular modules/components into non-angular-specific js bundles. just like we use bootstrap in our projects. – Shoaib Iqbal Jan 16 '19 at 09:59