-
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
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';<%} %> | ||
|
||
import { <%= classify(name) %><%= classify(type) %> } from './<%= dasherize(name) %>.<%= dasherize(type) %>'; | ||
|
||
|
@@ -8,9 +8,10 @@ describe('<%= classify(name) %><%= classify(type) %>', () => { | |
let fixture: ComponentFixture<<%= classify(name) %><%= classify(type) %>>; | ||
|
||
beforeEach(waitForAsync(() => { | ||
TestBed.configureTestingModule({ | ||
TestBed.configureTestingModule({<% if(!standalone) {%> | ||
declarations: [ <%= classify(name) %><%= classify(type) %> ], | ||
imports: [IonicModule.forRoot()] | ||
imports: [IonicModule.forRoot()]<%} %><% if(standalone) {%> | ||
imports: [<%= classify(name) %><%= classify(type) %>],<%} %> | ||
}).compileComponents(); | ||
Comment on lines
-13
to
+14
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If standalone we need to pass the component in |
||
|
||
fixture = TestBed.createComponent(<%= classify(name) %><%= classify(type) %>); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe 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,<%} %> | ||
}) | ||
export class <%= classify(name) %><%= classify(type) %> implements OnInit { | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. This uses actual Ionic standalone components instead of the lazy loaded ones. |
||
|
||
@Component({ | ||
selector: '<%= selector %>', | ||
templateUrl: './<%= dasherize(name) %>.page.html', | ||
styleUrls: ['./<%= dasherize(name) %>.page.<%= styleext %>'],<% if(standalone) {%> | ||
standalone: true, | ||
imports: [IonicModule, CommonModule, FormsModule]<%} %> | ||
imports: [IonContent, IonHeader, IonTitle, IonToolbar, CommonModule, FormsModule]<%} %> | ||
}) | ||
export class <%= classify(name) %>Page implements OnInit {<% if(routePath) { %> | ||
|
||
|
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