I'm working in angular project with own CSS which is almost done now i want to use ionic framework with cordova in my project. I tried but it is not working .
Is there any way and step by step process to add ionic framework in my existing Angular 4 project.
can i have any link or guidance to reach my goal.
Thanks in advance
For adding Ionic to an already existing Angular project, use the Angular CLI's ng add feature. This will add the necessary imports to the @ionic/angular package as well as add the styles needed.
To do that you can use the Angular CLI command “ng add” to import Ionic packages to the existing project. The following command will help you to do that. After successful package installation, you will take the output as follows. Then you must initialize your existing project with Ionic by using the following command.
There is a schematic command for adding ionic to an existing angular project:
ng add @ionic/angular
I have documented my approach here:
https://stack247.wordpress.com/2019/03/11/integrate-ionic-in-existing-angular-project/
This applies to
Essentially, these are the steps:
The step includes creating a new project using Ionic CLI, I'm going to refer it as Ionic project while my original Angular project as, well, Angular project.
ionic start project-name blank
ionic.config.json
from Ionic project to Angular project.angular.json
from Ionic project to Angular project.
angular.json
, make that necessary changes in the Angular project after the copy.projects/app/architect/**/options/styles
from Angular project's angular.json
prior to copy.package.json
from Ionic project to Angular project.
package.json
(npm scripts, etc), make that necessary changes in the Angular project after the copy.dependencies
and devDependencies
.package-lock.json
file and node_modules
folder. These should be located in root of the project.npm install
// Test run with Ionic
ionic serve
// Test run with Angular
ng serve --open
// For Android
ionic cordova prepare android
// For iOS
//ionic cordova prepare ios
Below Solution work for me: (I've added ionic in angular project with below steps)
ionic init
ng add @ionic/angular
To resolve above error follow below steps:
Open angular.json file:
change below properties
2.1 Before: outputPath: 'dist/<<project_name>>/browser' After: outputPath: 'www'
2.2 Replace <<PROJECT_NAME>> with "app". For Example: Before: 'my_angular_project:build:production' AFTER: 'app:build:production'
output
In case if you are facing scrolling issue
In project_name>src>style.css add below css properties
html, body {
overflow: auto !important;
}
body::-webkit-scrollbar {
display: none !important;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With