Advertisement
Guest User

Untitled

a guest
Mar 29th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. //controller
  2. angular.module('app').controller('MainCtrl', function ($scope, $compile) {
  3.  
  4. $scope.$on('insertItem',function(ev,attrs){
  5. var el = $compile( "<chart></chart>" )( $scope );
  6. $scope.insertHere = el;
  7. });
  8.  
  9. });
  10.  
  11.  
  12. // directive
  13. angular.module('app')
  14. .directive('chart', function () {
  15. return {
  16. template: '<div>My chart</div>',
  17. restrict: 'E',
  18. link: function postLink(scope, element, attrs) {
  19. element.text('this is a chart');
  20. }
  21. };
  22. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement