Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.2/angular.js"></script>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body ng-app="myApp">
    <my-parent></my-parent>
</body>
</html>
 
    var app = angular.module('myApp', []);
    app.directive('myParent', function () {
        return {
            restrict: 'EA',
            template: '<div>{{greeting}}{{name}}'+
            '<my-child></my-child>'+
            '</div>',
            controller: function(){
                this.name = 'Lovesueee';
            },
            link: function(scope,elem,attr,ctrl){
                scope.name = ctrl.name;
                scope.greeting = 'Hey, I am ';
            }
        };
    });
    app.directive('myChild', function () {
        return {
            restrict: 'EA',
            require: '^myParent',
            template: '<div>{{says}}</div>',
            link: function(scope,elem,attr,ctrl){
                scope.says = 'Hey, I am child, and my parent is '+ ctrl.name;
            }
        };
    });
Output 300px

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
Lovesueeepro
0viewers