Ionic-framework: Ionic v4 : Cannot to use ViewController

Created on 10 Aug 2018  路  4Comments  路  Source: ionic-team/ionic-framework

Bug Report

Ionic Info
Run ionic info from a terminal/cmd prompt and paste the output below.

Ionic:

ionic (Ionic CLI) : 4.0.5 (/home/mrnvr/.config/yarn/global/node_modules/ionic)
Ionic Framework : @ionic/angular 4.0.0-beta.2
@angular-devkit/core : 0.7.3
@angular-devkit/schematics : 0.7.3
@angular/cli : 6.1.3
@ionic/ng-toolkit : 1.0.6
@ionic/schematics-angular : 1.0.4

System:

NodeJS : v8.11.2 (/usr/bin/node)
npm : 6.3.0
OS : Linux 4.13

Describe the Bug
A clear and concise description of what the bug is.

Cannot use ViewController.

Steps to Reproduce
Steps to reproduce the behavior:

  1. When the IDE imports it, I get
    import { ViewController } from '@ionic/angular/dist/types/components/nav/view-controller';.
  2. Then when I try to build/serve my project it displays
    ERROR in node_modules/@ionic/angular/dist/types/components/nav/view-controller.d.ts(1,56): error TS2307: Cannot find module '../../interface'
  3. I change the import to import { ViewController } from @ionic/angular, I get
    TS2305: Module '"/home/marin/WebstormProjects/keyclic/applications/node_modules/@ionic/angular/dist/index"' has no exported member 'ViewController'.

Expected Behavior
A clear and concise description of what you expected to happen.

Being able to use ViewController

Additional Context
List any other information that is relevant to your issue. Stack traces, related issues, suggestions on how to fix, Stack Overflow links, forum links, screenshots, OS if applicable, etc.

I have the same problem as this issue #14749

triage

Most helpful comment

I think the ViewController is deprecated in v4

What for you would need it? If you need it to close a modal for example, you could use the ModalController instead. Same for PopoverController

this.viewController.dismiss() ===> this.modalController.dismiss()
this.viewController.dismiss() ===> this.popoverController.dismiss()

All 4 comments

I think the ViewController is deprecated in v4

What for you would need it? If you need it to close a modal for example, you could use the ModalController instead. Same for PopoverController

this.viewController.dismiss() ===> this.modalController.dismiss()
this.viewController.dismiss() ===> this.popoverController.dismiss()

Thanks it works. I thought you could only dismiss the modal from the component which created the modal.

@peterpeterparker you saved me many times today. V4 is amazing i don t regret switching even in Beta mode :D

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

MrBokeh picture MrBokeh  路  3Comments

giammaleoni picture giammaleoni  路  3Comments

manucorporat picture manucorporat  路  3Comments

gio82 picture gio82  路  3Comments

brandyscarney picture brandyscarney  路  3Comments