0

I'm just starting to learn Angular + Ionic, so pardon any potential ignorance :)

After, following the sample from Ionic's website I'm trying to expand upon it by assigning an ng-controller to my ion-nav-view. I'd like to use that so I can then listen for the $ionicView.enter on all the child views at one time, instead of having to do that separately inside of each child controller.

I add my controller like so:

<ion-nav-bar class="bar-positive">
  <ion-nav-back-button>
  </ion-nav-back-button>
</ion-nav-bar>

<ion-nav-view ng-controller="NavViewController"></ion-nav-view>

But it never actually executes the controller's constructor. If I move the assignment of the ng-controller up a level (e.g. the body element), it works fine. Is there any reason as to why that wouldn't work when assigned onto the ion-nav-view directly?

EDIT

Here's a codepen (trying to figure out why NavViewController isn't getting called):

http://codepen.io/anon/pen/WxYYkN

chinabuffet
  • 5,278
  • 9
  • 40
  • 64

1 Answers1

0

Try this answer. Sorry that I didn't researched enough and misunderstood the article I read.

Community
  • 1
  • 1
Jorawar Singh
  • 7,463
  • 4
  • 26
  • 39