These are the lifecycles to remember in AngularJS.
$onInit() implements IOnInit
Called when the controller has had all its bindings initialized.
$onDestroy() implements IOnDestroy
Called on a controller when its containing scope is destroyed.
Called whenever one-way bindings are updated.
Called on each turn of the digest cycle.
Called after this controller's element and its children have been linked.