Start with ionic, and a lot of questions

Hello, im using ionic for dev an app.
Im a belgian student so my english it’s no very good.

I have some question :

  1. I would like to create (just for test) an app for my contact .
    I’ve a controller "contactctrl"
    and i have some child view for example :
    contactdetailview
    contacteditview

So what i want to do it’s simple (in php mvc) :
I would like to change view when i click on contact or edit icon .

Till now i do that :
Have 3 controller:

  1. Contact controller : using for view contact list
  2. Contactdetailcontroller : using for view contact detail
    3.Contacteditcontroller : using for view edit contact.

With state a change de view and it’s very good .
But when i’ve edited a contact, i would come back to detail view, but the data not change on this view !! (in fact, the data is directly updated in db and when i reload my app the data is change).

So i don’t know how can i set the correct data , i mean when i use $state.go(“contactdetail”,{detail : clientedited}); why the data isn’t good?

I have an idea for keep it simple :

Juste have one contactcontroller (like i did in php mvc) and change only view with populate data
Example :
have one var for list of contact , one var for current contact (detail).
And juste change de view … But how can i do that?

Thank and sorry for my english.

Hi,

Directives are the way foreward if you like to keep everything on 1 view.
Share your variables between directives over the same (parent) scope and bind those with ng-bind in your html template.

Since I understand you’re new to the game, it may be a bit scary to get into directives, but they are actually fairly easy and super powerfull.
I started off about a year ago just like you and todayIi do nearly everything with directives rather than changing views.

My learning curve was a bit like; “mm interesting -> it just doesn`t work -> Oh, that was easy -> how the hell do you get … done -> Woow I didn’t know you could … so simple -> angularJS is he best!”

Ionic has a great platform to get you going but as with any language one needs to understand the underlying structure. Ionic is like a great package of directives for you to use, but doesn’t limit you for making your own.

To get started:
https://docs.angularjs.org/guide/directive

If you struggle with english, send me a message. I cover all languages poken in belgium.
Try to share through the forum though so everybody can learn.

OK, i studied angular last year, i never use custom directive … can you explain me quickly how can i do that ?
So if you can speak french, parle en francais :smiley:

Bonjour, je parle le Francais mais ici dans le forum on parlons en Anglais.Côme ca touts les gens comprendre
(Translation: Hi, I do speak french but on this forum we speak English. That way everybody understands)

I cannot explain everything in just a post. Best is to start of reading a few articles.
Here are a few links to get you going on the concept. It helped me a lot when i began:


http://onehungrymind.com/angularjs-directives-basics/

en Francais:


http://blog.zenika.com/2013/12/19/angularjs-les-directives/

Bon chance
(good luck)

OK merci whizz, peux tu communiquer par email ? hangout ou autre?? j’ai pas mal de petite questions en faite et j’aime bien bosser avec un “prof”

je ne suis pas un prof, seulement j’ai beaucoup de curiosité.
Cette forum n’est pas pour enseigner les trucs de base du AngularJS.

I’m not professor nor professional, I am just a very curious person.
This forum is not about teaching the basics of AngularJS I think

Any specific issue can be cleared out on it’s respective forum.
Good luck in your exporation and don’t forget that the road to the finish can be more rewarding than the finish itself. Enjoy it.