Can we have nested Controllers in Angular Js?

 Posted by Chvrsri on 3/28/2016 | Category: AngularJS Interview questions | Views: 943 | Points: 40
Answer:

Yes we can have nested controllers. The thing is it works in a hierarchical way while using a View.

Example:

GrandFather ---- Father ---- Son

<div ng-controller="GrandFather">

<p>{{message}} {{name}}!</p>
<div ng-controller="Father">
<p>Hello {{name}}!</p>
<div ng-controller="Son">
<p>{{message}} {{name}}! Your username is {{username}}.</p>
</div>
</div>
</div>


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response