Hi All,

We use angular directive in a somewhat "polymer" way in our application.

In main page:
<div class="header">
    <main-menu>
</div>

In main menu directive:
<div>
  <div>
    <button1>
    <button2>
    <button3>
  </div>
  <div ng-switch on="currentBtn">
    <div when="button1">
      <account-info>
    </div>
    <div when="button2">
      <shopping-cart>
    </div>
    <div when="button3">
      <contact-us>
    </div>
  </div>
</div>

Every single directive has there own controller and template.
For example, in <account-info> controller:
I have console.log("hey hey, its account info").

One thing I have observed is, each time if "button1" is clicked, 
<account-info> will be displayed on the page and in the console, it will 
print out "hey hey, its account info".

So, I think I'm a little confused on the life-cycle of the directive 
controller.
If the view is not displayed for the directive, the controller will not be 
executed?
I thought the controller will be executed only once at the compilation time 
for the directives.



 

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to