Can we have nested Controllers in Angular Js?

 Posted by Chvrsri on 3/28/2016 | Category: AngularJS 1x Interview questions | Views: 5279 | Points: 40

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


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>

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response