Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70612

Is tutorial wrong on Ionic site?

$
0
0

@LuckyWolf19 wrote:

According to this tutorial , my code is showing errors in Visual Studio Code. It showing errors for

`import {Page, NavController} from 'ionic/ionic';

@Page({
templateUrl: 'app/hello-ionic/hello-ionic.html'
})
export class HelloIonicPage {
constructor(nav: NavController) {
this.nav = nav;
}
}`

However, if I change import to 'ionic-framework/ionic' and put private in front of nav variable name in constructor it seems to work. Is this correct?

`import {Page, NavController} from 'ionic-framework/ionic';

@Page({
templateUrl: 'app/hello-ionic/hello-ionic.html'
})
export class HelloIonicPage {
constructor(private nav: NavController) {
this.nav = nav;
}
}`

reference:

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 70612

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>