-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: use Ionic standalone components #504
Conversation
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; | ||
import { IonicModule } from '@ionic/angular'; | ||
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';<% if(!standalone) {%> | ||
import { IonicModule } from '@ionic/angular';<%} %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IonicModule
is only needed for the lazy loaded build
imports: [IonicModule.forRoot()] | ||
imports: [IonicModule.forRoot()]<%} %><% if(standalone) {%> | ||
imports: [<%= classify(name) %><%= classify(type) %>],<%} %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If standalone we need to pass the component in imports
. If not standalone we need to pass the component in declarations
and IonicModule
in imports.
@@ -3,7 +3,8 @@ import { Component, OnInit } from '@angular/core'; | |||
@Component({ | |||
selector: '<%= selector %>', | |||
templateUrl: './<%= dasherize(name) %>.<%= dasherize(type) %>.html', | |||
styleUrls: ['./<%= dasherize(name) %>.<%= dasherize(type) %>.<%= styleext %>'], | |||
styleUrls: ['./<%= dasherize(name) %>.<%= dasherize(type) %>.<%= styleext %>'],<% if(standalone) {%> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This wasn't there before, but the application compiled. My understanding is that standalone components should have standalone: true
.
@@ -2,14 +2,14 @@ import { Component, OnInit } from '@angular/core';<% if(routePath) { %> | |||
import { ActivatedRoute, Params } from '@angular/router';<% } %><% if(standalone) {%> | |||
import { CommonModule } from '@angular/common'; | |||
import { FormsModule } from '@angular/forms'; | |||
import { IonicModule } from '@ionic/angular';<%} %> | |||
import { IonContent, IonHeader, IonTitle, IonToolbar } from '@ionic/angular/standalone';<%} %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This uses actual Ionic standalone components instead of the lazy loaded ones.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Proposed changes look good.
Support for generating standalone components and pages was added in 5523f7a. However, this work used the lazy loaded build of Ionic via
IonicModule
since Ionic standalone components did not exist yet.Now that Ionic standalone components have been released, I'd like to update the page/component generation to use Ionic standalone components instead of
IonicModule
.Note: You may encounter a
waitForAsync
syntax error when testing. This is fixed in #505.closes #500