Skip to content

component generator does not respect --changeDetection Flag #94

Open
@distante

Description

@distante

Steps to Reproduce:

ionic start
npm install @angular/cli@7.3.4
ng g component Test --changeDetection=OnPush --entryComponent

Output:
Generated component:

import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'app-training-options',
  templateUrl: './training-options.component.html',
  styleUrls: ['./training-options.component.scss'],
})
export class TrainingOptionsComponent implements OnInit {

  constructor() { }

  ngOnInit() {}

}

My ionic info:

Ionic:

   ionic (Ionic CLI)             : 4.10.3 (C:\Users\distante\AppData\Roaming\npm\node_modules\ionic)
   Ionic Framework               : @ionic/angular 4.0.2
   @angular-devkit/build-angular : 0.12.4
   @angular-devkit/schematics    : 7.3.4
   @angular/cli                  : 7.3.4
   @ionic/angular-toolkit        : 1.4.0

System:

   NodeJS : v10.14.1 (C:\Program Files\nodejs\node.exe)
   npm    : 6.5.0
   OS     : Windows 10

Other Information:
Using a Pure angular Project ng g generates the correct component.

Activity

changed the title [-]Ionic cli g does not respect --changeDetection Flag[/-] [+]component generator does not respect --changeDetection Flag[/+] on Mar 6, 2019
mhartington

mhartington commented on Mar 6, 2019

@mhartington
Contributor

Thanks for the issue! We'll get this fixed it asap

imhoffd

imhoffd commented on Aug 30, 2019

@imhoffd
Contributor

@mhartington Looks like this is erroring in 2.0.0? #177

Lindsor

Lindsor commented on May 6, 2020

@Lindsor

Seems like your schematics for components also doesnt support the changeDetection default in angular.json just want to make sure that gets fixed as well since they are related.

Sampath-Lokuge

Sampath-Lokuge commented on Jun 8, 2020

@Sampath-Lokuge

Hi @dwieeb Will we have this soon or?

GaryLoop

GaryLoop commented on Aug 28, 2020

@GaryLoop

Also looking for a fix.

bagbag

bagbag commented on Jul 21, 2021

@bagbag

Is there any workaround until this is fixed?

Edit:
Simply remove "defaultCollection": "@ionic/angular-toolkit" from angular.json, if you don't need any of ionics collection

demym

demym commented on Nov 29, 2021

@demym

Hi, i am too using Ionic5 and using the workaround of putting this.changeRef.detectChanges() on my backend calls.... never had to do that in Ionic3 (which i used until a little time ago).

I also tried to remove "defaultCollection" from angular.json, but that does not change anything... i am still forced to use detectChanges...

P.S: this happens more in the iOS version of my app; under 'ionic serve' i do not observe this behaviour.... (and all works as in ionic3, without detectchanges instruction

this is my ionic info:

Ionic:

   Ionic CLI                     : 5.4.16 (/usr/local/lib/node_modules/ionic)
   Ionic Framework               : @ionic/angular 5.9.1
   @angular-devkit/build-angular : 12.1.4
   @angular-devkit/schematics    : 12.1.4
   @angular/cli                  : 12.1.4
   @ionic/angular-toolkit        : 4.0.0

Cordova:

   Cordova CLI       : 10.0.0 (cordova-lib@10.1.0)
   Cordova Platforms : ios 6.2.0
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 5.0.0, (and 6 other plugins)

Utility:

   cordova-res : not installed
   native-run  : not installed

System:

   Android SDK Tools : 26.1.1 (/Users/demetriomortelliti/Library/Android/sdk)
   ios-sim           : 8.0.2
   NodeJS            : v14.15.5 (/usr/local/bin/node)
   npm               : 6.14.11
   OS                : macOS Big Sur
   Xcode             : Xcode 13.0 Build version 13A233
pseudooriginal

pseudooriginal commented on Jun 15, 2022

@pseudooriginal

Any updates on this?

evan-boissonnot

evan-boissonnot commented on Apr 26, 2024

@evan-boissonnot

I use angular cli 18 rc4, ng g component test-push --changeDetection=OnPush generate same prob : changeDetection is not recognize

3 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @imhoffd@GaryLoop@mhartington@Lindsor@bagbag

        Issue actions

          component generator does not respect --changeDetection Flag · Issue #94 · ionic-team/angular-toolkit