Wraps other elements

by raji_rvr

HTML

<h1>4. Wraps other elements</h1>

<div ng-app="myApp">
    <div ng-controller="myTransCtrl">             
      <my-dialog>Email, {{msg}}!</my-dialog>
  </div>
</div>

JavaScript

'use strict';

/* App Module */

var app = angular.module("myApp", []);

app.controller("myTransCtrl", function($scope) {
    $scope.msg = 'can not be blank!';   
});

// Directive
app.directive('myDialog', function() {
  return {
    restrict: 'E',
    transclude: true,
    scope: {},
    template: '<div class="alert" ng-transclude>'+
    '</div>',
    link: function (scope, element) {
      scope.msg = '[email protected]';
    }
  };
});