No app.js and controller.js folder


#1

i am new in ionic . there is no app.js and controller.js folder .so where should i write controller and router program in my project.


#2

it is in the www folder in IONIC 1 and src folder in Ionic 2 for sure
if not you may have an error or corruption while starting ionic project
did you try . “ionic start appName --v2”? --v2 is for ionic 2


#3

CLI v2.2.3+ defaults to building modern Ionic projects, and requires the --v1 switch to make v1 ones. If you want to make a v1 project, this thread is in the wrong category.


#4

Yeah that means you have a Ionic-v1 project. Please post in the according forum thread (ionic-v1).


#5

i have created project for ionic 2 .
created src folder are

content of app folder are
where should i write controller and route program.


#6

Read the docs.


#7

Actually there are a lot of examples around which use .controller and .factory

I was wondering the same, where to put them in ionic2? In the documentation I was not able to find this information.

Could one help me out here?


#8

Nowhere. They don’t exist. Those are Angular1 concepts. Angular2 is a completely different framework.


#9

To summarize it:

app.module.ts ===> where you load all pages, and services needed on a global level
app.ts ==> works fine by default, can be tweaked to many things if you need

After Controller is built inside any .ts page you use.
As for Factory, I think (not 100% sure), this is the Ionic2 equivalent of a provider value, or use a value in the Construtor, that will inherit in all page template(.html) with bindings.


#11

All that is good, except you miss for the providers. And Typescript is not at all Angular 2 (weil in ionic 2 it it is, but it’s a clumsy definition).
As for Ionic 2 same as controller of Ionic 1, no, defintely not. Please read the docs.


#12

Shashiraz… I’m facing the same problem. Can you plz help me understand this if you have overcame this hurdle?


#13

I am new to ionic didn’t use ionic 1 and 2 can anyone please tell me where I can find app.js file in Ionic 3 ?


#14

You don’t write or manipulate any .js files in Ionic 2+. You are working with typescript. I recommend to start with the docs on angular first, to learn some basics about typescript and angular. Angular is a core dependency of ionic and builds the foundation of the ionic framework.

You could start with these resources:
https://basarat.gitbooks.io/typescript/

https://angular.io/tutorial


#15

Hello, the simpliest way is to create a new project, once updated to ionic 3.


#16

go to your ionic project folder —> src —> app -----> app.js you can find it