Ionic-framework: [4.0.0-beta19] Import Content gives Error has no exported member 'Content'.

Created on 19 Dec 2018  路  8Comments  路  Source: ionic-team/ionic-framework

Bug Report

Ionic version:
[x] 4.x

Current behavior:
Upon upgrading to Bet19 including dependant angular packages, i am getting an error;

[ng] src/app/pages/setting/setting-user-terms/setting-user-terms.page.ts(2,10): error TS2305: Module '"/Users/core/www/ourmgmt-client/node_modules/@ionic/angular/dist/index"' has no exported member 'Content'.
[ng] 

Upon investigation I am importing Content from @ionic/angular. If I remove the reference it compiles. Has support for content been deprecated in Ionic 4.0.19?

Related code:

import { Component, ViewChild, OnInit } from '@angular/core';
import { Content, ModalController } from '@ionic/angular';


@Component({
  selector: 'app-setting-user-terms',
  templateUrl: './setting-user-terms.page.html',
  styleUrls: ['./setting-user-terms.page.scss'],
})
export class SettingUserTermsPage implements OnInit {

  @ViewChild(Content) content: Content;
  constructor(private modalCtrl: ModalController) {
  }

  ngOnInit() {
  }

  dismiss(): void {
    this.modalCtrl.dismiss();
  }
  /*
  ** name: Scroll To Top
  ** desc: Scroll To Top(for pagaination in survey mode)
  */
  scrollTo(value: string) {
    let yOffset = document.getElementById(value).offsetTop;
    this.content.scrollToPoint(0, yOffset, 1000);
  }
}

Other information:

Ionic info:

Ionic:

   ionic (Ionic CLI)             : 4.5.0 (/usr/local/lib/node_modules/ionic)
   Ionic Framework               : @ionic/angular 4.0.0-beta.19
   @angular-devkit/build-angular : 0.10.6
   @angular-devkit/schematics    : 7.1.2
   @angular/cli                  : 7.1.3
   @ionic/angular-toolkit        : 1.2.0

Cordova:

   cordova (Cordova CLI) : 7.1.0
   Cordova Platforms     : browser 5.0.4
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 2.2.0, (and 9 other plugins)

System:

   ios-deploy : 1.9.1
   NodeJS     : v10.10.0 (/usr/local/bin/node)
   npm        : 6.5.0
   OS         : macOS High Sierra

triage

All 8 comments

Content has changed to IonContent. Changing that should fix it.

Content has changed to IonContent. Changing that should fix it.

Are you sure??? I have tried the following which gives me an import error:

import { IonContent, ModalController } from '@ionic/angular';

It needs to be refreshed. Try ctrl + clicking on @ionic/angular so it will detect the update.

Thanks mate, rebooting my text editor worked. I couldn't find this as a breaking change in Ionic/Changelog, is it in there?

Also I am getting another error now, I'll make it another issue, unless you know the issue behind this error?

[ng] ERROR in ./node_modules/@ionic/angular/dist/app-initialize.js
[ng] Module not found: Error: Can't resolve 'ionicons' in '/Users/core/www/ourmgmt-client/node_modules/@ionic/angular/dist'
[ng] ERROR in ./node_modules/@ionic/angular/dist/app-initialize.js
[ng] Module not found: Error: Can't resolve 'ionicons/icons' in '/Users/core/www/ourmgmt-client/node_modules/@ionic/angular/dist'

In the changelog they wrote in general that Ionic components now have the pefix of Ion. I don't know what your other issue is.

Ignore the above, I had an old version of ionicons, upgrading to 4.5.1 resolved the issue. Thanks again!

Issue resolved

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

danbucholtz picture danbucholtz  路  3Comments

brandyscarney picture brandyscarney  路  3Comments

daveshirman picture daveshirman  路  3Comments

BilelKrichen picture BilelKrichen  路  3Comments

MrBokeh picture MrBokeh  路  3Comments