Where can I make imports on the new .js


#1

Hello there, a while ago I made an app that used the Reddit’se public API. I recently downloaded ionic again but everything is really different and I’m struggling to understand the new folders and files.

Back then I had a src/app/main.ts and src/pages/home.ts, where I imported Reddit’s API and everything else. I’m trying to recreate that application but I can’t find the .ts. I know that the new version of the Ionic uses .js. Should I import everything on the app.js and controllers.js?

I need to import:

import { InAppBrowser } from '@ionic-native/in-app-browser';
import { RedditService } from '../../providers/reddit-service';
import { FormControl } from '@angular/forms';
import { HttpModule } from '@angular/http';

I can’t find the @NgModule too. Back them my NgModule looked like this:

@NgModule({
  declarations: [
    MyApp,
    HomePage
  ],
  imports: [
    BrowserModule,
    HttpModule,
    IonicModule.forRoot(MyApp)
  ],
  bootstrap: [IonicApp],
  entryComponents: [
    MyApp,
    HomePage
  ],
  providers: [
    StatusBar,
    SplashScreen,
    RedditService,
    {provide: ErrorHandler, useClass: IonicErrorHandler}
  ]
})

Here’s the current version informations:

Cordova CLI: 7.0.1
Ionic CLI Version: 2.2.2
Ionic App Lib Version: 2.2.1
ios-deploy version: Not installed
ios-sim version: Not installed
OS: macOS Sierra
Node Version: v6.10.2
Xcode version: Xcode 8.3.3 Build version 8E3004b

Thank you!


#2

Throw this project away, upgrade the CLI to at least 2.2.3, and then recreate it.

Your 2.2.2 CLI defaults to creating v1 projects, yet you are probably following documentation assuming a newer version which defaults to creating current Ionic projects with the structure you are expecting.


#3

I’m not following any documentation, I’m trying to recreate my old project. Back then I used this ts files. How can I import reddit’s API now?

Thank you!


#4

I don’t mean to be rude, but read what I wrote and follow the instructions.


#5

So what do you have right now? What commands did you execute, what files are there now etc…