# Adding Ionic + Capacitor to existing Angular project

**URL:** <https://forum.ionicframework.com/t/adding-ionic-capacitor-to-existing-angular-project/212810>\
**Category:** ionic-v3\
**Created:** [July 22, 2021, 8:34am UTC](https://forum.ionicframework.com/t/adding-ionic-capacitor-to-existing-angular-project/212810 "2021-07-22T08:34:18Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![wekas](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/wekas/32/124745_2.png) [@wekas](https://forum.ionicframework.com/u/wekas)\
**Post date:** [July 22, 2021, 8:34am UTC](https://forum.ionicframework.com/t/adding-ionic-capacitor-to-existing-angular-project/212810/1 "2021-07-22T08:34:18Z")

</div>

I have an existing Angular project I would like to add Ionic/Capacitor to.  
Is there a standard way of doing this or any resources to follow?

---

<div class="post-metadata">

**Author:** ![EinfachHans](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/einfachhans/32/130917_2.png) [@EinfachHans](https://forum.ionicframework.com/u/EinfachHans)\
**Post date:** [July 22, 2021, 9:00am UTC](https://forum.ionicframework.com/t/adding-ionic-capacitor-to-existing-angular-project/212810/2 "2021-07-22T09:00:10Z")

</div>

Ionic: [Ionic Packages - Ionic Documentation](https://ionicframework.com/docs/intro/cdn#ionic-angular)

Capacitor: [Capacitor - build cross platform apps with the web](https://capacitorjs.com/docs/getting-started)

---

<div class="post-metadata">

**Author:** ![wekas](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/wekas/32/124745_2.png) [@wekas](https://forum.ionicframework.com/u/wekas)\
**Post date:** [July 22, 2021, 8:20pm UTC](https://forum.ionicframework.com/t/adding-ionic-capacitor-to-existing-angular-project/212810/3 "2021-07-22T20:20:48Z")

</div>

I guess I should expand.  
I want to turn my Angular app into an Ionic/capacitor app that I can run on ios and android and serve using ionic serve.  
The same as if I created a new Ionic project.  
These instructions do not provide that capability.

Maybe I will just try making a new Ionic app and copy in all my Angular components.

---

<div class="post-metadata">

**Author:** ![EinfachHans](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/einfachhans/32/130917_2.png) [@EinfachHans](https://forum.ionicframework.com/u/EinfachHans)\
**Post date:** [July 22, 2021, 8:25pm UTC](https://forum.ionicframework.com/t/adding-ionic-capacitor-to-existing-angular-project/212810/4 "2021-07-22T20:25:56Z")

</div>

“For adding Ionic to an already existing Angular project, use the Angular CLI’s `ng add` feature.”

```auto
$ ng add @ionic/angular

```

Sounds like what you described

---

<div class="post-metadata">

**Author:** ![rapropos](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/rapropos/32/100227_2.png) [@rapropos](https://forum.ionicframework.com/u/rapropos)\
**Post date:** [July 22, 2021, 8:32pm UTC](https://forum.ionicframework.com/t/adding-ionic-capacitor-to-existing-angular-project/212810/5 "2021-07-22T20:32:44Z")

</div>

> [@wekas](#):
>
> I want to turn my Angular app into an Ionic/capacitor app

I think that slash is a bit thicker than you seem to.

“Ionic” to me, at this point in time, is best thought of as a component library. I think of Capacitor as a successor to PhoneGap and Cordova.

So turning an existing Angular app into an Ionic app and turning an existing app into a Capacitor app strikes me as two radically different things. You very well may wish to do both, or you may wish to do only one, but I definitely wouldn’t necessarily think of them as a package.

Capacitor is great. I don’t want to throw shade on it at all. That being said, if you don’t absolutely need it, I would consider PWA an option with considerably less friction involved at many points in the development process:

- you can run and debug in a desktop browser with automatic recompilation and reloading
- no need to rely on app stores with all their associated baggage for distribution
- truly a single codebase, so testing has fewer platform-specific edge cases to worry about

Given that you seem to already have an Angular app, the only reasons I would _want_ to get Capacitor involved would be:

- I _want_ to distribute via app stores for marketing reasons
- I want to add previously nonexistent functionality that needs something on the native side of the bridge

For Ionic, the question is whether I (or my userbase) prefers Ionic’s implementation of various UI widgets to whatever else we have currently. That would, in addition to the `ng add` that @EinfachHans is suggesting, require selectively swapping out various existing `<wekas-thingy>` components for `<ion-thingy>` replacements.

That could still be done regardless of the decision to get Capacitor involved or not.

---

<div class="post-metadata">

**Author:** ![wekas](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/wekas/32/124745_2.png) [@wekas](https://forum.ionicframework.com/u/wekas)\
**Post date:** [July 22, 2021, 9:26pm UTC](https://forum.ionicframework.com/t/adding-ionic-capacitor-to-existing-angular-project/212810/6 "2021-07-22T21:26:48Z")

</div>

It needs to be distributed via the app stores. (I’m a fan of PWA’s but this is not my project).  
I only need some of ionic UI components really.

I tried the instructions @EinfachHans suggested but it is not as simple as that.  
I am aware of most of the options e.g. Capacitor only but what I am after is explicit instructions on how to do this.

I could probably sit down and figure it out but I am trying to see how much work it is in advance as previously I have always created an Ionic project.

---

<div class="post-metadata">

**Author:** ![rapropos](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/rapropos/32/100227_2.png) [@rapropos](https://forum.ionicframework.com/u/rapropos)\
**Post date:** [July 22, 2021, 9:36pm UTC](https://forum.ionicframework.com/t/adding-ionic-capacitor-to-existing-angular-project/212810/7 "2021-07-22T21:36:40Z")

</div>

> [@wekas](#):
>
> I tried the instructions @EinfachHans suggested but it is not as simple as that.

How so? Looks to me like it’s at least _intended_ to be as simple as that. `ng add` support was added [in late 2018](https://github.com/ionic-team/ionic-framework/pull/15323), and looking at the stuff in [angular/src/schematics](https://github.com/ionic-team/ionic-framework/tree/main/angular/src/schematics), it looks it contains imports for all the twiddly bits needed to support using Ionic components.

Now, that’s for Ionic. Capacitor has [a totally separate onboarding procedure](https://capacitorjs.com/docs/getting-started#adding-capacitor-to-your-app) that’s basically `npm i stuff && npx cap init`, which spawns an interactive (_ick_, but whatever) process to fill out the rest.

---

<div class="post-metadata">

**Author:** ![wekas](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/wekas/32/124745_2.png) [@wekas](https://forum.ionicframework.com/u/wekas)\
**Post date:** [July 22, 2021, 10:22pm UTC](https://forum.ionicframework.com/t/adding-ionic-capacitor-to-existing-angular-project/212810/8 "2021-07-22T22:22:17Z")

</div>

You are right, I just needed to invest more time.  
I spent more than 5 mins on it and I got it working on Android just using capacitor.

I will have a play with adding in some Ionic components next.

Thanks for the response.

---

<div class="post-metadata">

**Author:** ![source144](https://avatars.discourse-cdn.com/v4/letter/s/dec6dc/32.png) [@source144](https://forum.ionicframework.com/u/source144)\
**Post date:** [July 29, 2021, 4:31am UTC](https://forum.ionicframework.com/t/adding-ionic-capacitor-to-existing-angular-project/212810/9 "2021-07-29T04:31:14Z")

</div>

Almost a year ago I managed to port a full webapp I made in react to a functioning PWA and it only took me a couple of days. Added a couple of features that would be mobile specific and some changes between the web-app and PWA and published to Google Play store. Haven’t tried with Angular, but I would assume it wouldn’t be any different, HTML, javascript and CSS are the same and you can consider ionic as a sort of wrapper.

Good luck!

---

<div class="post-metadata">

**Author:** ![The-Lone-Druid](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/the-lone-druid/32/144783_2.png) [@The-Lone-Druid](https://forum.ionicframework.com/u/The-Lone-Druid)\
**Post date:** [July 11, 2023, 7:51am UTC](https://forum.ionicframework.com/t/adding-ionic-capacitor-to-existing-angular-project/212810/10 "2023-07-11T07:51:54Z")

</div>

As a professional, I totally agree with what you said.
