order of angular controller's initialisation

October 05, 2015

Reading time ~1 minute

Outline

Angular controllers are initialized from parent to child. So child controllers can not get any event from parent controller when parent controller is initialized.

Detail

This is simple sample.

JS Bin on jsbin.com

Controller’s code is really simple. They outpu their name in conole after initialized. In this sample, controller are declared from thirdController, secondController, firstController in order.

But their names outputed in conole are bellow.

"init firstController"
"init secondController"
"init thirdController"

Because Angular controller are initialized from parent dom to child dom regardless of the declared order.

So be careful childredn controllers (thirdController, secondController) can not get any event from parent controller when parent controller is initialized (child controllers are not initialized).

add ticket number to git commit automatically

Most of ticket tracker like Github, pivotal tracker have function to connect your commit to ticket(story).But every time when you commit ...… Continue reading

I will build frontend and backend separately

Published on September 28, 2016

don't forget $digest in angular directive unit test

Published on September 27, 2015