AngularJS Tutorial 7:Controller Inheritance and nested controllers in AngularJS

Controller Inheritance or nested Controllers in AngularJS

<!DOCTYPE html>
    <script src="angular.min.js"></script>
    <meta charset="utf-8" />
        var myApp = angular.module("myModule", [])

        myApp.controller("parentController", function ($scope) {
            $ = "parent Controller";
        myApp.controller("firstLevelController", function ($scope) {
            //$ = "parent Controller";
        myApp.controller("secondController", function ($scope) {
            $ = "second level Controller";

<body ng-app="myModule">
    <div ng-controller="parentController">
        Parent divison: {{name}}
        <div ng-controller="firstLevelController">
           First level : {{name}}
            <div ng-controller="secondController">
            SecondLevel    {{name}}


If you have any queries or suggestions, please feel free to ask in comments section.
Share this post :

Post a Comment

Please give your valuable feedback on this post. You can submit any ASP.NET article here. We will post that article in this website by your name.

Support : Ranga Rajesh Kumar
Copyright © 2012. ASP.NET Examples - All Rights Reserved
Site Designed by Ranga Rajesh Kumar